# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752679 | 2023-06-03T12:15:49 Z | DeathIsAwe | Carnival (CEOI14_carnival) | C++17 | 8 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; int binsearch(int c,vector<int>& uppl) { int org=c; int a=0,b=c/2,output; while (a!=b) { cout << c-b+1 << ' '; for (int i=b;i<c;i++) { cout << uppl[i] << ' '; } cout << uppl[org] << '\n'; cin >> output; if (output<c-b+1) { a=b; b=(c-a)/2+a; } else { c=b; b=(c-a)/2+a; } } return b; } int main() { vector<vector<int>> samekind(151); int n,output; cin >> n; vector<int> ans(n+1); vector<int> uppl; for (int i=0;i<n;i++) { uppl.push_back(i+1); } int canceler=0,searchres; for (int i=0;i<n;i++) { cout << i+1-canceler << ' '; for (int j=0;j<i-canceler+1;j++) { cout << uppl[j] << ' '; } cout << '\n'; cin >> output; if (output<i+1-canceler) { searchres=binsearch(i-canceler,uppl); samekind[uppl[searchres]].push_back(uppl[i-canceler]); uppl.erase(uppl.begin()+i-canceler); canceler+=1; } } for (int i=0;i<uppl.size();i++) { ans[uppl[i]]=i+1; for (auto &j: samekind[uppl[i]]) { ans[j]=i+1; } } cout << 0 << ' '; for (int i=1;i<n+1;i++) { cout << ans[i] << ' '; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 208 KB | Output is correct |
2 | Correct | 5 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 2 ms | 208 KB | Output is correct |
5 | Correct | 3 ms | 208 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 5 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 4 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 5 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 208 KB | Output is correct |
2 | Correct | 5 ms | 208 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 208 KB | Output is correct |
6 | Correct | 3 ms | 208 KB | Output is correct |
7 | Correct | 5 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 3 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 208 KB | Output is correct |
6 | Correct | 5 ms | 208 KB | Output is correct |
7 | Correct | 8 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 208 KB | Output is correct |
2 | Correct | 5 ms | 208 KB | Output is correct |
3 | Correct | 6 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 208 KB | Output is correct |
5 | Correct | 6 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 3 ms | 208 KB | Output is correct |