# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251915 | 2020-07-23T06:01:01 Z | tqbfjotld | On the Grid (FXCUP4_grid) | C++17 | 6 ms | 384 KB |
#include "grid.h" #include <bits/stdc++.h> using namespace std; int n; int pos[1005]; ///position of size i int ans[1005]; vector<int> confirmed; int wrap(vector<int> v){ for (int x = confirmed.size()-1; x>=0; x--){ v.push_back(confirmed[x]); } vector<int> newv; for (auto x : v){ newv.push_back(x-1); } int res = PutDisks(newv); if (confirmed.size()==n-1) assert(res==n); return res-confirmed.size(); } vector<int> SortDisks(int N) { n = N; for (int x = N; x>=1; x--){ vector<int> qu; vector<int> rem; for (int y = 1; y<=N; y++){ if (ans[y]) continue; rem.push_back(y); } for (int y : rem){ qu.clear(); qu.push_back(y); for (int z : rem){ if (z!=y) qu.push_back(z); } if (wrap(qu)==x+x-1){ ans[y] = x; confirmed.push_back(y); //printf("%d at %d\n",x,y); break; } } } vector<int> ans2; for (int x = 1; x<=n; x++){ ans2.push_back(ans[x]); //printf("push %d\n",ans[x]); } return ans2; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Incorrect | 6 ms | 384 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Incorrect | 6 ms | 384 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |