//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "swaps.h"
const int maxn = 555;
int grid[maxn][maxn];
bool cmp(int x,int y) {
if (grid[x][y]!=-1) return grid[x][y];
return grid[y][x]^1;
}
void solve(int N, int V) {
// TODO implement this function
memset(grid,-1,sizeof(grid));
rep(i,1,N) {
for (int j=1;j+i<=N;j+=i*2)
rep(k,0,i) if (j+k+i<=N) schedule(j+k,j+k+i);
vector <int> tmp = visit();
reverse(ALL(tmp));
for (int j=1;j+i<=N;j+=i*2)
rep(k,0,i) if (j+k+i<=N) grid[j+k][j+k+i] = tmp.back(), tmp.pop_back();
for (int j=1+i;j+i<=N;j+=i*2)
rep(k,0,i) if (j+k+i<=N) schedule(j+k,j+k+i);
tmp = visit();
reverse(ALL(tmp));
for (int j=1+i;j+i<=N;j+=i*2)
rep(k,0,i) if (j+k+i<=N) grid[j+k][j+k+i] = tmp.back(), tmp.pop_back();
}
vector <int> ret;
rep(i,0,N) ret.pb(i+1);
sort(ALL(ret),cmp);
answer(ret);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1488 KB |
Correct |
2 |
Correct |
4 ms |
1508 KB |
Correct |
3 |
Correct |
24 ms |
1508 KB |
Correct |
4 |
Correct |
49 ms |
1552 KB |
Correct |
5 |
Correct |
46 ms |
1524 KB |
Correct |
6 |
Correct |
47 ms |
1524 KB |
Correct |
7 |
Correct |
48 ms |
1520 KB |
Correct |
8 |
Correct |
47 ms |
1528 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1488 KB |
Correct |
2 |
Correct |
5 ms |
1512 KB |
Correct |
3 |
Correct |
20 ms |
1508 KB |
Correct |
4 |
Correct |
48 ms |
1540 KB |
Correct |
5 |
Correct |
46 ms |
1520 KB |
Correct |
6 |
Correct |
48 ms |
1524 KB |
Correct |
7 |
Correct |
45 ms |
1556 KB |
Correct |
8 |
Correct |
46 ms |
1516 KB |
Correct |
9 |
Correct |
50 ms |
1588 KB |
Correct |
10 |
Correct |
56 ms |
1644 KB |
Correct |
11 |
Correct |
42 ms |
1648 KB |
Correct |
12 |
Correct |
50 ms |
1520 KB |
Correct |
13 |
Correct |
68 ms |
1528 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1448 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1448 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1488 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |