# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527513 | 2022-02-17T14:25:34 Z | beepbeepsheep | On the Grid (FXCUP4_grid) | C++17 | 12 ms | 332 KB |
#include "grid.h" #include <bits/stdc++.h> using namespace std; #define ll int std::vector<int> SortDisks(int n) { vector<int> v,ans(n); int chk[n]; memset(chk,-1,sizeof(chk)); for (int i=0;i<n;i++){ v.push_back(i); } ll a=PutDisks(v),b; vector<int> w; while (v.size()){ w.clear(); ll t=v.back(),p=0; for (int i=v.size()-1;i>0;i--) swap(v[i],v[i-1]); for (int i=0;i<n;i++){ if (chk[i]!=-1) w.push_back(chk[i]); else w.push_back(v[p++]); } b=PutDisks(w); if (b>a-1){ t=v[0]; ans[t]=b-(n-1); chk[ans[t]-1]=t; for (int i=0;i<v.size()-1;i++) swap(v[i],v[i+1]); v.pop_back(); } else a=b; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 292 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 292 KB | Output is correct |
15 | Correct | 1 ms | 276 KB | Output is correct |
16 | Correct | 2 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 296 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 292 KB | Output is correct |
9 | Correct | 1 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 1 ms | 292 KB | Output is correct |
15 | Correct | 1 ms | 276 KB | Output is correct |
16 | Correct | 2 ms | 204 KB | Output is correct |
17 | Correct | 2 ms | 204 KB | Output is correct |
18 | Correct | 8 ms | 292 KB | Output is correct |
19 | Correct | 9 ms | 296 KB | Output is correct |
20 | Correct | 12 ms | 324 KB | Output is correct |
21 | Correct | 7 ms | 292 KB | Output is correct |
22 | Correct | 10 ms | 204 KB | Output is correct |
23 | Correct | 11 ms | 204 KB | Output is correct |
24 | Correct | 11 ms | 324 KB | Output is correct |
25 | Correct | 11 ms | 328 KB | Output is correct |
26 | Correct | 11 ms | 320 KB | Output is correct |