#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
void solve(int n, int q) {
vector<int> ord;
for(int i = 0 ; i < n; i ++ )
ord.push_back(i + 1);
int cc;
for(int go = 0; go < n; go ++ ){
if(go % 2 == 0){
for(int i = 0 ; i + 1 < n; i += 2){
schedule(ord[i], ord[i + 1]);
}
vector<int> cha = visit();
cc = 0;
for(int i = 0; i + 1 < n; i += 2){
if(cha[cc] == 0) swap(ord[i], ord[i + 1]);
cc ++ ;
}
}
else{
for(int i = 1 ; i + 1 < n; i += 2){
schedule(ord[i], ord[i + 1]);
}
vector<int> cha = visit();
cc = 0;
for(int i = 1; i + 1 < n; i += 2){
if(cha[cc] == 0) swap(ord[i], ord[i + 1]);
cc ++ ;
}
}
}
answer(ord);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
52 ms |
316 KB |
Correct |
5 |
Correct |
52 ms |
296 KB |
Correct |
6 |
Correct |
53 ms |
300 KB |
Correct |
7 |
Correct |
62 ms |
376 KB |
Correct |
8 |
Correct |
52 ms |
300 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
53 ms |
320 KB |
Correct |
5 |
Correct |
55 ms |
396 KB |
Correct |
6 |
Correct |
61 ms |
296 KB |
Correct |
7 |
Correct |
65 ms |
396 KB |
Correct |
8 |
Correct |
65 ms |
420 KB |
Correct |
9 |
Correct |
67 ms |
300 KB |
Correct |
10 |
Correct |
54 ms |
296 KB |
Correct |
11 |
Correct |
50 ms |
496 KB |
Correct |
12 |
Correct |
51 ms |
296 KB |
Correct |
13 |
Correct |
59 ms |
292 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
3 |
Correct |
1 ms |
200 KB |
Correct |
4 |
Correct |
4 ms |
200 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
51 ms |
296 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
51 ms |
296 KB |
Correct |
5 |
Correct |
1 ms |
200 KB |
Correct |
6 |
Correct |
4 ms |
200 KB |
Correct |
7 |
Correct |
16 ms |
200 KB |
Correct |
8 |
Correct |
53 ms |
292 KB |
Correct |
9 |
Correct |
50 ms |
368 KB |
Correct |
10 |
Correct |
51 ms |
292 KB |
Correct |
11 |
Correct |
54 ms |
316 KB |
Correct |
12 |
Correct |
50 ms |
296 KB |
Correct |
13 |
Correct |
1 ms |
200 KB |
Correct |
14 |
Correct |
5 ms |
200 KB |
Correct |
15 |
Correct |
15 ms |
200 KB |
Correct |
16 |
Correct |
54 ms |
356 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
52 ms |
384 KB |
Correct |
5 |
Correct |
51 ms |
272 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
200 KB |
Correct |
4 |
Correct |
52 ms |
384 KB |
Correct |
5 |
Correct |
51 ms |
272 KB |
Correct |
6 |
Correct |
1 ms |
200 KB |
Correct |
7 |
Correct |
4 ms |
200 KB |
Correct |
8 |
Correct |
17 ms |
200 KB |
Correct |
9 |
Correct |
51 ms |
292 KB |
Correct |
10 |
Correct |
52 ms |
296 KB |
Correct |
11 |
Correct |
51 ms |
296 KB |
Correct |
12 |
Correct |
55 ms |
364 KB |
Correct |
13 |
Correct |
67 ms |
296 KB |
Correct |
14 |
Correct |
53 ms |
324 KB |
Correct |
15 |
Correct |
53 ms |
352 KB |
Correct |
16 |
Correct |
53 ms |
296 KB |
Correct |
17 |
Correct |
53 ms |
292 KB |
Correct |
18 |
Correct |
61 ms |
296 KB |
Correct |
19 |
Correct |
1 ms |
200 KB |
Correct |
20 |
Correct |
4 ms |
200 KB |
Correct |
21 |
Correct |
14 ms |
200 KB |
Correct |
22 |
Correct |
53 ms |
292 KB |
Correct |
23 |
Correct |
55 ms |
392 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
17 ms |
200 KB |
Correct |
4 |
Correct |
52 ms |
500 KB |
Correct |
5 |
Correct |
53 ms |
296 KB |
Correct |
6 |
Runtime error |
11 ms |
276 KB |
Execution killed with signal 13 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
3 ms |
200 KB |
Correct |
3 |
Correct |
17 ms |
200 KB |
Correct |
4 |
Correct |
52 ms |
500 KB |
Correct |
5 |
Correct |
53 ms |
296 KB |
Correct |
6 |
Runtime error |
11 ms |
276 KB |
Execution killed with signal 13 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
236 KB |
Correct |
4 |
Correct |
51 ms |
352 KB |
Correct |
5 |
Correct |
52 ms |
296 KB |
Correct |
6 |
Runtime error |
11 ms |
276 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct |
2 |
Correct |
4 ms |
200 KB |
Correct |
3 |
Correct |
15 ms |
236 KB |
Correct |
4 |
Correct |
51 ms |
352 KB |
Correct |
5 |
Correct |
52 ms |
296 KB |
Correct |
6 |
Runtime error |
11 ms |
276 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |