#include <swaps.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
/*void schedule(int i, int j){
cout << "schedule " << i << " " << j << "\n";
}
vector<int> visit(){
cout << "visit\n";
int n;
cin >> n;
vector<int> ans(n);
for(int i=0; i<n; i++){
cin >> ans[i];
}
return ans;
}
void answer(vector<int>& ans){
cout << "answer: \n";
for(auto e: ans){
cout << e << " ";
}
cout << "\n";
}*/
void solve(int n, int v){
vector<int> a(n);
for(int i=0; i<n; i++){
a[i]=i+1;
}
for(int i=0; i<v; i++){
if(i%2==0){
for(int j=0; j+1<n; j+=2){
schedule(a[j], a[j+1]);
}
vector<int> resp=visit();
for(int j=0; j+1<n; j+=2){
if(resp[j/2]==0) swap(a[j], a[j+1]);
}
}
else{
for(int j=1; j+1<n; j+=2){
schedule(a[j], a[j+1]);
}
vector<int> resp=visit();
for(int j=1; j+1<n; j+=2){
if(resp[j/2]==0) swap(a[j], a[j+1]);
}
}
}
answer(a);
}
/*signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, v;
cin >> n >> v;
solve(n, v);
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
208 KB |
Correct |
2 |
Correct |
110 ms |
208 KB |
Correct |
3 |
Correct |
236 ms |
280 KB |
Correct |
4 |
Correct |
424 ms |
408 KB |
Correct |
5 |
Correct |
469 ms |
408 KB |
Correct |
6 |
Correct |
431 ms |
564 KB |
Correct |
7 |
Correct |
434 ms |
404 KB |
Correct |
8 |
Correct |
425 ms |
408 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
208 KB |
Correct |
2 |
Correct |
126 ms |
208 KB |
Correct |
3 |
Correct |
248 ms |
276 KB |
Correct |
4 |
Correct |
498 ms |
396 KB |
Correct |
5 |
Correct |
431 ms |
408 KB |
Correct |
6 |
Correct |
465 ms |
408 KB |
Correct |
7 |
Correct |
439 ms |
412 KB |
Correct |
8 |
Correct |
440 ms |
484 KB |
Correct |
9 |
Correct |
85 ms |
308 KB |
Correct |
10 |
Correct |
77 ms |
300 KB |
Correct |
11 |
Correct |
96 ms |
304 KB |
Correct |
12 |
Correct |
93 ms |
300 KB |
Correct |
13 |
Correct |
93 ms |
408 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
208 KB |
Correct |
2 |
Correct |
151 ms |
208 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
208 KB |
Correct |
2 |
Correct |
151 ms |
208 KB |
Correct |
3 |
Correct |
49 ms |
208 KB |
Correct |
4 |
Correct |
100 ms |
208 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
123 ms |
208 KB |
Correct |
3 |
Correct |
224 ms |
284 KB |
Correct |
4 |
Correct |
411 ms |
456 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
208 KB |
Correct |
2 |
Correct |
123 ms |
208 KB |
Correct |
3 |
Correct |
224 ms |
284 KB |
Correct |
4 |
Correct |
411 ms |
456 KB |
Correct |
5 |
Correct |
48 ms |
208 KB |
Correct |
6 |
Correct |
113 ms |
208 KB |
Correct |
7 |
Correct |
231 ms |
276 KB |
Correct |
8 |
Correct |
426 ms |
456 KB |
Correct |
9 |
Correct |
432 ms |
424 KB |
Correct |
10 |
Correct |
441 ms |
384 KB |
Correct |
11 |
Correct |
428 ms |
516 KB |
Correct |
12 |
Correct |
463 ms |
380 KB |
Correct |
13 |
Correct |
45 ms |
208 KB |
Correct |
14 |
Correct |
99 ms |
292 KB |
Correct |
15 |
Correct |
261 ms |
280 KB |
Correct |
16 |
Correct |
464 ms |
488 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
208 KB |
Correct |
2 |
Correct |
113 ms |
208 KB |
Correct |
3 |
Correct |
248 ms |
280 KB |
Correct |
4 |
Correct |
429 ms |
520 KB |
Correct |
5 |
Correct |
39 ms |
304 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
208 KB |
Correct |
2 |
Correct |
113 ms |
208 KB |
Correct |
3 |
Correct |
248 ms |
280 KB |
Correct |
4 |
Correct |
429 ms |
520 KB |
Correct |
5 |
Correct |
39 ms |
304 KB |
Correct |
6 |
Correct |
51 ms |
208 KB |
Correct |
7 |
Correct |
89 ms |
296 KB |
Correct |
8 |
Correct |
272 ms |
284 KB |
Correct |
9 |
Correct |
412 ms |
400 KB |
Correct |
10 |
Correct |
428 ms |
420 KB |
Correct |
11 |
Correct |
426 ms |
528 KB |
Correct |
12 |
Correct |
423 ms |
420 KB |
Correct |
13 |
Correct |
429 ms |
476 KB |
Correct |
14 |
Correct |
77 ms |
304 KB |
Correct |
15 |
Correct |
74 ms |
404 KB |
Correct |
16 |
Correct |
77 ms |
404 KB |
Correct |
17 |
Correct |
80 ms |
396 KB |
Correct |
18 |
Correct |
100 ms |
308 KB |
Correct |
19 |
Correct |
56 ms |
208 KB |
Correct |
20 |
Correct |
135 ms |
208 KB |
Correct |
21 |
Correct |
260 ms |
276 KB |
Correct |
22 |
Correct |
452 ms |
528 KB |
Correct |
23 |
Correct |
43 ms |
296 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
208 KB |
Correct |
2 |
Correct |
112 ms |
208 KB |
Correct |
3 |
Correct |
242 ms |
280 KB |
Correct |
4 |
Correct |
427 ms |
408 KB |
Correct |
5 |
Correct |
40 ms |
388 KB |
Correct |
6 |
Incorrect |
9 ms |
316 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
208 KB |
Correct |
2 |
Correct |
112 ms |
208 KB |
Correct |
3 |
Correct |
242 ms |
280 KB |
Correct |
4 |
Correct |
427 ms |
408 KB |
Correct |
5 |
Correct |
40 ms |
388 KB |
Correct |
6 |
Incorrect |
9 ms |
316 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
208 KB |
Correct |
2 |
Correct |
109 ms |
208 KB |
Correct |
3 |
Correct |
229 ms |
284 KB |
Correct |
4 |
Correct |
418 ms |
468 KB |
Correct |
5 |
Correct |
40 ms |
300 KB |
Correct |
6 |
Incorrect |
8 ms |
408 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
208 KB |
Correct |
2 |
Correct |
109 ms |
208 KB |
Correct |
3 |
Correct |
229 ms |
284 KB |
Correct |
4 |
Correct |
418 ms |
468 KB |
Correct |
5 |
Correct |
40 ms |
300 KB |
Correct |
6 |
Incorrect |
8 ms |
408 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |