# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583345 | 2022-06-25T09:04:36 Z | WongChun1234 | The Collection Game (BOI21_swaps) | C++14 | 65 ms | 428 KB |
// // --- Sample implementation for the task swaps --- // // To compile this program with the sample grader, place: // swaps.h swaps_sample.cpp sample_grader.cpp // in a single folder and run: // g++ swaps_sample.cpp sample_grader.cpp // in this folder. // #include "swaps.h" #include<bits/stdc++.h> using namespace std; const int N=550; int rrl[N]; vector<pair<int,int>> sch; void solve(int n, int v) { // TODO implement this function for (int i=1;i<=n;i++) rrl[i]=i; for (int i=2;i<=n;i++){ for (int j=(i%2)+1;j<i;j+=2){ schedule(rrl[j],rrl[j+1]); sch.push_back({rrl[j],rrl[j+1]}); } vector<int> res=visit(); for (int j=0,pos=(i%2)+1;j<res.size();j++,pos+=2){ if (res[j]){ //frnt < back, 60% must //rrl[j] now has smaller one }else{ //rrl[j] has bigger one swap(rrl[pos],rrl[pos+1]); } } sch.clear(); } for (int i=n-1;i>=2;i--){ for (int j=(i%2)+1;j<i;j+=2){ schedule(rrl[j],rrl[j+1]); sch.push_back({rrl[j],rrl[j+1]}); } vector<int> res=visit(); for (int j=0,pos=(i%2)+1;j<res.size();j++,pos+=2){ if (res[j]){ //frnt < back, 60% must //rrl[j] now has smaller one }else{ //rrl[j] has bigger one swap(rrl[pos],rrl[pos+1]); } } sch.clear(); } vector<int> ans(n); for (int i=1;i<=n;i++) ans[i-1]=rrl[i]; answer(ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 5 ms | 300 KB | Correct |
3 | Correct | 13 ms | 308 KB | Correct |
4 | Correct | 61 ms | 320 KB | Correct |
5 | Correct | 64 ms | 320 KB | Correct |
6 | Correct | 60 ms | 324 KB | Correct |
7 | Correct | 48 ms | 320 KB | Correct |
8 | Correct | 52 ms | 320 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 6 ms | 208 KB | Correct |
3 | Correct | 16 ms | 308 KB | Correct |
4 | Correct | 62 ms | 316 KB | Correct |
5 | Correct | 51 ms | 324 KB | Correct |
6 | Correct | 55 ms | 324 KB | Correct |
7 | Correct | 65 ms | 316 KB | Correct |
8 | Correct | 51 ms | 320 KB | Correct |
9 | Correct | 64 ms | 316 KB | Correct |
10 | Correct | 58 ms | 324 KB | Correct |
11 | Correct | 60 ms | 316 KB | Correct |
12 | Correct | 65 ms | 316 KB | Correct |
13 | Correct | 64 ms | 320 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 5 ms | 208 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 5 ms | 208 KB | Correct |
3 | Correct | 1 ms | 208 KB | Correct |
4 | Correct | 5 ms | 292 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 5 ms | 208 KB | Correct |
3 | Correct | 13 ms | 308 KB | Correct |
4 | Correct | 43 ms | 316 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 5 ms | 208 KB | Correct |
3 | Correct | 13 ms | 308 KB | Correct |
4 | Correct | 43 ms | 316 KB | Correct |
5 | Correct | 1 ms | 208 KB | Correct |
6 | Correct | 4 ms | 336 KB | Correct |
7 | Correct | 19 ms | 304 KB | Correct |
8 | Correct | 48 ms | 428 KB | Correct |
9 | Correct | 43 ms | 328 KB | Correct |
10 | Correct | 47 ms | 360 KB | Correct |
11 | Correct | 44 ms | 324 KB | Correct |
12 | Correct | 46 ms | 320 KB | Correct |
13 | Correct | 1 ms | 208 KB | Correct |
14 | Correct | 4 ms | 308 KB | Correct |
15 | Correct | 18 ms | 308 KB | Correct |
16 | Correct | 63 ms | 320 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 208 KB | Correct |
3 | Correct | 14 ms | 308 KB | Correct |
4 | Correct | 45 ms | 316 KB | Correct |
5 | Runtime error | 21 ms | 320 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 208 KB | Correct |
3 | Correct | 14 ms | 308 KB | Correct |
4 | Correct | 45 ms | 316 KB | Correct |
5 | Runtime error | 21 ms | 320 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 300 KB | Correct |
3 | Correct | 17 ms | 296 KB | Correct |
4 | Correct | 44 ms | 316 KB | Correct |
5 | Runtime error | 30 ms | 320 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 300 KB | Correct |
3 | Correct | 17 ms | 296 KB | Correct |
4 | Correct | 44 ms | 316 KB | Correct |
5 | Runtime error | 30 ms | 320 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 208 KB | Correct |
3 | Correct | 20 ms | 308 KB | Correct |
4 | Correct | 57 ms | 328 KB | Correct |
5 | Runtime error | 32 ms | 352 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Correct |
2 | Correct | 4 ms | 208 KB | Correct |
3 | Correct | 20 ms | 308 KB | Correct |
4 | Correct | 57 ms | 328 KB | Correct |
5 | Runtime error | 32 ms | 352 KB | Execution killed with signal 13 |
6 | Halted | 0 ms | 0 KB | - |