# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
735188 | 2023-05-03T16:47:59 Z | DAleksa | Art Collections (BOI22_art) | C++17 | 0 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 = 0; i < n; i++) cout << inv[i] << " "; cout << "\n"; for(int i = 1; i < n; i++) inv[i] = (inv[i] - inv[0] + n - i) / 2; for(int i = 0; i < n; i++) cout << inv[i] << " "; cout << "\n"; 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; } } reverse(res.begin(), res.end()); answer(res); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Security violation! |
2 | Halted | 0 ms | 0 KB | - |