# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
735176 | 2023-05-03T16:38:12 Z | DAleksa | Art Collections (BOI22_art) | C++17 | 1 ms | 208 KB |
#include <bits/stdc++.h> #include "art.h" using namespace std; void solve(int n) { vector<int> inv(n); vector<int> ask(n); iota(ask.begin(), ask.end(), 1); inv[0] = publish(ask); for(int i = 1; i < n; i++) { ask[n - 1] = i; for(int j = 0; j < n - 1; j++) ask[j] = (j + 1 < i ? j + 1 : j + 2); inv[i] = publish(ask); } for(int i = 1; i < n; i++) inv[i] = (inv[0] - inv[i] + n - i) / 2; vector<int> res(n); vector<bool> mark(n + 1, false); for(int i = 1; i < n; i++) { int cnt = 0; for(int j = 1; j <= n; j++) { if(mark[j]) continue; cnt++; if(cnt == inv[i] + 1) { res[i - 1] = j; mark[j] = true; } } } for(int i = 1; i <= n; i++) { if(!mark[i]) { res[n - 1] = i; break; } } answer(res); } // inv[0] - inv[1] = < - > // < + > = n - 1 // inv[0] - inv[1] + n - 1 = 2 * < //
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 1 ms | 208 KB | Output is correct |
3 | Correct | 1 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Incorrect | 1 ms | 208 KB | Not correct |
6 | Halted | 0 ms | 0 KB | - |