Submission #403623

# Submission time Handle Problem Language Result Execution time Memory
403623 2021-05-13T10:17:46 Z b00n0rp The Collection Game (BOI21_swaps) C++17
100 / 100
7 ms 324 KB
#include<bits/stdc++.h>
#include "swaps.h"
using namespace std;

int a[1005];

void solve(int N, int V){
	for(int i = 0; i < 2*N; i ++) a[i] = i+1;
	int po2 = 1;
	while(po2 < N) po2 *= 2;
	for(int k = 2; k <= po2; k *= 2){
		for(int j = k/2; j >= 1; j/= 2){
			for(int i = 0; i < po2; i ++){
				int l = (i^j);
				if(l > i){
					if((i&k) == 0){
						if(a[l] > N) continue;
						if(a[i] > N) swap(a[i],a[l]);
						else schedule(a[i],a[l]);
					}
					else{
						if(a[i] > N) continue;
						if(a[l] > N) swap(a[i],a[l]);
						else schedule(a[l],a[i]);
					}
				}
			}
			vector<int> gg = visit();
			int cur = 0;
			for(int i = 0; i < po2; i ++){
				int l = (i^j);
				if(l > i){
					if(a[i] > N or a[l] > N) continue;
					if(gg[cur] != 1) swap(a[i],a[l]);
					cur++;
				}
			}
		}
	}
	vector<int> ans;
	for(int i = 0; i < N; i ++){
		ans.push_back(a[i]);
	}
	answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 6 ms 296 KB Correct
5 Correct 6 ms 300 KB Correct
6 Correct 6 ms 300 KB Correct
7 Correct 6 ms 296 KB Correct
8 Correct 6 ms 292 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 4 ms 292 KB Correct
4 Correct 6 ms 296 KB Correct
5 Correct 6 ms 292 KB Correct
6 Correct 6 ms 296 KB Correct
7 Correct 6 ms 292 KB Correct
8 Correct 6 ms 292 KB Correct
9 Correct 5 ms 292 KB Correct
10 Correct 6 ms 292 KB Correct
11 Correct 6 ms 296 KB Correct
12 Correct 6 ms 296 KB Correct
13 Correct 6 ms 324 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 1 ms 200 KB Correct
4 Correct 2 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 5 ms 292 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 5 ms 292 KB Correct
5 Correct 1 ms 200 KB Correct
6 Correct 2 ms 200 KB Correct
7 Correct 3 ms 296 KB Correct
8 Correct 6 ms 296 KB Correct
9 Correct 6 ms 292 KB Correct
10 Correct 5 ms 296 KB Correct
11 Correct 5 ms 292 KB Correct
12 Correct 6 ms 292 KB Correct
13 Correct 1 ms 200 KB Correct
14 Correct 2 ms 200 KB Correct
15 Correct 3 ms 200 KB Correct
16 Correct 7 ms 288 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 296 KB Correct
4 Correct 5 ms 288 KB Correct
5 Correct 5 ms 284 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 296 KB Correct
4 Correct 5 ms 288 KB Correct
5 Correct 5 ms 284 KB Correct
6 Correct 1 ms 200 KB Correct
7 Correct 2 ms 200 KB Correct
8 Correct 3 ms 200 KB Correct
9 Correct 5 ms 296 KB Correct
10 Correct 5 ms 300 KB Correct
11 Correct 7 ms 292 KB Correct
12 Correct 6 ms 300 KB Correct
13 Correct 6 ms 296 KB Correct
14 Correct 6 ms 296 KB Correct
15 Correct 7 ms 292 KB Correct
16 Correct 7 ms 296 KB Correct
17 Correct 6 ms 300 KB Correct
18 Correct 6 ms 296 KB Correct
19 Correct 1 ms 200 KB Correct
20 Correct 2 ms 200 KB Correct
21 Correct 3 ms 296 KB Correct
22 Correct 6 ms 296 KB Correct
23 Correct 6 ms 292 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 6 ms 296 KB Correct
5 Correct 5 ms 272 KB Correct
6 Correct 5 ms 276 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 6 ms 296 KB Correct
5 Correct 5 ms 272 KB Correct
6 Correct 5 ms 276 KB Correct
7 Correct 1 ms 200 KB Correct
8 Correct 2 ms 200 KB Correct
9 Correct 3 ms 200 KB Correct
10 Correct 5 ms 292 KB Correct
11 Correct 6 ms 296 KB Correct
12 Correct 6 ms 296 KB Correct
13 Correct 7 ms 292 KB Correct
14 Correct 7 ms 296 KB Correct
15 Correct 6 ms 292 KB Correct
16 Correct 5 ms 292 KB Correct
17 Correct 5 ms 300 KB Correct
18 Correct 5 ms 300 KB Correct
19 Correct 6 ms 304 KB Correct
20 Correct 1 ms 200 KB Correct
21 Correct 2 ms 200 KB Correct
22 Correct 3 ms 296 KB Correct
23 Correct 6 ms 292 KB Correct
24 Correct 7 ms 276 KB Correct
25 Correct 7 ms 276 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 7 ms 296 KB Correct
5 Correct 6 ms 280 KB Correct
6 Correct 5 ms 296 KB Correct
7 Correct 5 ms 276 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 3 ms 200 KB Correct
4 Correct 7 ms 296 KB Correct
5 Correct 6 ms 280 KB Correct
6 Correct 5 ms 296 KB Correct
7 Correct 5 ms 276 KB Correct
8 Correct 1 ms 200 KB Correct
9 Correct 1 ms 200 KB Correct
10 Correct 1 ms 200 KB Correct
11 Correct 3 ms 200 KB Correct
12 Correct 6 ms 296 KB Correct
13 Correct 6 ms 296 KB Correct
14 Correct 6 ms 292 KB Correct
15 Correct 6 ms 300 KB Correct
16 Correct 5 ms 292 KB Correct
17 Correct 6 ms 296 KB Correct
18 Correct 6 ms 300 KB Correct
19 Correct 5 ms 292 KB Correct
20 Correct 5 ms 296 KB Correct
21 Correct 6 ms 296 KB Correct
22 Correct 1 ms 200 KB Correct
23 Correct 2 ms 200 KB Correct
24 Correct 3 ms 200 KB Correct
25 Correct 6 ms 296 KB Correct
26 Correct 7 ms 288 KB Correct
27 Correct 6 ms 276 KB Correct
28 Correct 6 ms 272 KB Correct