- 全排列
深度优先搜索
- 2025-2-9 17:04:45 @
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define TRACE 1
#define tcout TRACE && cout
#define fst ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define int long long
const int P = 998244353;
const int Base = 3221225477;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e6 + 10, M = 2e6 + 10;
int n;
int a[N],b[N];
bool flag=false;
signed main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
next_permutation(a+1,a+n+1);
for(int i=1;i<=n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
0 comments
No comments so far...
Information
- ID
- 1555
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 405
- Accepted
- 5
- Uploaded By