# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
429093 | 2021-06-15T17:22:16 Z | keko37 | The Collection Game (BOI21_swaps) | C++14 | 8 ms | 540 KB |
#include<bits/stdc++.h> #include "swaps.h" using namespace std; typedef pair <int, int> pi; const int MAXN = 505; int n, p[MAXN]; vector <pi> v; void upd () { for (auto pp : v) schedule(p[pp.first], p[pp.second]); vector <int> ans = visit(); for (int i = 0; i < ans.size(); i++) { if (ans[i] == 0) swap(p[v[i].first], p[v[i].second]); } } void solve (int N, int V) { n = N; for (int i = 0; i < n; i++) p[i] = i + 1; for (int i = 0; i < 9; i++) { v.clear(); for (int pos = 0; pos < n; pos++) { int par = pos ^ ((1 << (i + 1)) - 1); if (par < pos) v.push_back({par, pos}); } upd(); for (int j = i - 1; j >= 0; j--) { v.clear(); for (int pos = 0; pos < n; pos++) { int par = pos ^ (1 << j); if (par < pos) v.push_back({par, pos}); } upd(); } } vector <int> sol; for (int i = 0; i < n; i++) sol.push_back(p[i]); answer(sol); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 2 ms | 296 KB | Correct |
3 | Correct | 3 ms | 200 KB | Correct |
4 | Correct | 5 ms | 308 KB | Correct |
5 | Correct | 6 ms | 304 KB | Correct |
6 | Correct | 7 ms | 296 KB | Correct |
7 | Correct | 6 ms | 400 KB | Correct |
8 | Correct | 6 ms | 300 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 300 KB | Correct |
5 | Correct | 7 ms | 300 KB | Correct |
6 | Correct | 6 ms | 304 KB | Correct |
7 | Correct | 6 ms | 304 KB | Correct |
8 | Correct | 6 ms | 304 KB | Correct |
9 | Correct | 5 ms | 300 KB | Correct |
10 | Correct | 5 ms | 296 KB | Correct |
11 | Correct | 6 ms | 304 KB | Correct |
12 | Correct | 7 ms | 300 KB | Correct |
13 | Correct | 7 ms | 304 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Correct |
2 | Correct | 2 ms | 292 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | Correct |
2 | Correct | 2 ms | 292 KB | Correct |
3 | Correct | 1 ms | 200 KB | Correct |
4 | Correct | 2 ms | 200 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 3 ms | 200 KB | Correct |
3 | Correct | 4 ms | 296 KB | Correct |
4 | Correct | 6 ms | 304 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 3 ms | 200 KB | Correct |
3 | Correct | 4 ms | 296 KB | Correct |
4 | Correct | 6 ms | 304 KB | Correct |
5 | Correct | 1 ms | 200 KB | Correct |
6 | Correct | 2 ms | 332 KB | Correct |
7 | Correct | 3 ms | 200 KB | Correct |
8 | Correct | 6 ms | 304 KB | Correct |
9 | Correct | 7 ms | 300 KB | Correct |
10 | Correct | 7 ms | 300 KB | Correct |
11 | Correct | 6 ms | 292 KB | Correct |
12 | Correct | 7 ms | 300 KB | Correct |
13 | Correct | 1 ms | 200 KB | Correct |
14 | Correct | 2 ms | 200 KB | Correct |
15 | Correct | 4 ms | 200 KB | Correct |
16 | Correct | 6 ms | 300 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 2 ms | 200 KB | Correct |
3 | Correct | 4 ms | 200 KB | Correct |
4 | Correct | 7 ms | 308 KB | Correct |
5 | Correct | 8 ms | 296 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 2 ms | 200 KB | Correct |
3 | Correct | 4 ms | 200 KB | Correct |
4 | Correct | 7 ms | 308 KB | Correct |
5 | Correct | 8 ms | 296 KB | Correct |
6 | Correct | 2 ms | 200 KB | Correct |
7 | Correct | 3 ms | 200 KB | Correct |
8 | Correct | 4 ms | 200 KB | Correct |
9 | Correct | 6 ms | 304 KB | Correct |
10 | Correct | 5 ms | 296 KB | Correct |
11 | Correct | 6 ms | 304 KB | Correct |
12 | Correct | 6 ms | 304 KB | Correct |
13 | Correct | 6 ms | 300 KB | Correct |
14 | Correct | 7 ms | 308 KB | Correct |
15 | Correct | 5 ms | 304 KB | Correct |
16 | Correct | 5 ms | 308 KB | Correct |
17 | Correct | 7 ms | 308 KB | Correct |
18 | Correct | 7 ms | 304 KB | Correct |
19 | Correct | 2 ms | 200 KB | Correct |
20 | Correct | 2 ms | 292 KB | Correct |
21 | Correct | 3 ms | 200 KB | Correct |
22 | Correct | 6 ms | 300 KB | Correct |
23 | Correct | 6 ms | 284 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 308 KB | Correct |
5 | Correct | 6 ms | 288 KB | Correct |
6 | Correct | 6 ms | 280 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 308 KB | Correct |
5 | Correct | 6 ms | 288 KB | Correct |
6 | Correct | 6 ms | 280 KB | Correct |
7 | Correct | 1 ms | 200 KB | Correct |
8 | Correct | 2 ms | 200 KB | Correct |
9 | Correct | 3 ms | 288 KB | Correct |
10 | Correct | 6 ms | 300 KB | Correct |
11 | Correct | 5 ms | 308 KB | Correct |
12 | Correct | 7 ms | 540 KB | Correct |
13 | Correct | 6 ms | 308 KB | Correct |
14 | Correct | 6 ms | 304 KB | Correct |
15 | Correct | 5 ms | 296 KB | Correct |
16 | Correct | 6 ms | 300 KB | Correct |
17 | Correct | 6 ms | 300 KB | Correct |
18 | Correct | 6 ms | 304 KB | Correct |
19 | Correct | 6 ms | 304 KB | Correct |
20 | Correct | 1 ms | 200 KB | Correct |
21 | Correct | 2 ms | 296 KB | Correct |
22 | Correct | 4 ms | 200 KB | Correct |
23 | Correct | 6 ms | 308 KB | Correct |
24 | Correct | 8 ms | 304 KB | Correct |
25 | Correct | 6 ms | 284 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 2 ms | 296 KB | Correct |
3 | Correct | 3 ms | 200 KB | Correct |
4 | Correct | 8 ms | 304 KB | Correct |
5 | Correct | 6 ms | 300 KB | Correct |
6 | Correct | 6 ms | 284 KB | Correct |
7 | Correct | 7 ms | 280 KB | Correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Correct |
2 | Correct | 2 ms | 296 KB | Correct |
3 | Correct | 3 ms | 200 KB | Correct |
4 | Correct | 8 ms | 304 KB | Correct |
5 | Correct | 6 ms | 300 KB | Correct |
6 | Correct | 6 ms | 284 KB | Correct |
7 | Correct | 7 ms | 280 KB | Correct |
8 | Correct | 1 ms | 200 KB | Correct |
9 | Correct | 1 ms | 200 KB | Correct |
10 | Correct | 2 ms | 200 KB | Correct |
11 | Correct | 3 ms | 200 KB | Correct |
12 | Correct | 6 ms | 304 KB | Correct |
13 | Correct | 5 ms | 300 KB | Correct |
14 | Correct | 7 ms | 300 KB | Correct |
15 | Correct | 6 ms | 304 KB | Correct |
16 | Correct | 6 ms | 304 KB | Correct |
17 | Correct | 6 ms | 300 KB | Correct |
18 | Correct | 6 ms | 300 KB | Correct |
19 | Correct | 6 ms | 300 KB | Correct |
20 | Correct | 6 ms | 304 KB | Correct |
21 | Correct | 5 ms | 300 KB | Correct |
22 | Correct | 1 ms | 200 KB | Correct |
23 | Correct | 3 ms | 296 KB | Correct |
24 | Correct | 3 ms | 200 KB | Correct |
25 | Correct | 6 ms | 300 KB | Correct |
26 | Correct | 5 ms | 396 KB | Correct |
27 | Correct | 7 ms | 284 KB | Correct |
28 | Correct | 6 ms | 280 KB | Correct |