#include <bits/stdc++.h>
#include "swaps.h"
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;
vector <int> r;
vector <pii> Q;
void Schedule(int i,int j){
schedule(r[i],r[j]);
Q.push_back({i,j});
}
void Visit(){//交换逆序元素,最多调用50次
if(!Q.size())return;
vector <int> res=visit();
rep(i,0,(int)res.size())if(!res[i])swap(r[Q[i].fi],r[Q[i].se]);
Q.clear();
}
void solve(int n,int q){
rep(i,1,n)r.push_back(i);
for(int k=2;k<=2*n;k<<=1){
rep(i,0,n-1){
int x=i^(k-1);
if(i<x&&x<n)Schedule(i,x);
}
Visit();
for(int j=k>>2;j;j>>=1){
rep(i,0,n-1){
int x=i^j;
if(i<x&&x<n)Schedule(i,x);
}
Visit();
}
}
answer(r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |