# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008497 | 2024-06-26T13:35:42 Z | VMaksimoski008 | Carnival (CEOI14_carnival) | C++17 | 5 ms | 596 KB |
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; signed main() { int n; cin >> n; vector<int> diff; vector<int> v(n+1); v[1] = 1; diff.push_back(1); auto query = [&](vector<int> &vec) { cout << vec.size(); for(int &el : vec) cout << " " << el; cout << endl; int ans; cin >> ans; return ans; }; int id = 2; for(int i=2; i<=n; i++) { int x = diff.size(); diff.push_back(i); if(query(diff) == diff.size()) { v[i] = id++; continue; } diff.pop_back(); int l=0, r=diff.size()-1, p=r; while(l <= r) { int mid = (l + r) / 2; vector<int> vec; for(int j=0; j<=mid; j++) vec.push_back(diff[j]); vec.push_back(i); if(query(vec) == vec.size() - 1) p = mid, r = mid - 1; else l = mid + 1; } v[i] = v[diff[p]]; } cout << 0; for(int i=1; i<=n; i++) cout << " " << v[i]; cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 344 KB | Output is correct |
3 | Correct | 3 ms | 344 KB | Output is correct |
4 | Correct | 2 ms | 344 KB | Output is correct |
5 | Correct | 2 ms | 344 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 344 KB | Output is correct |
4 | Correct | 2 ms | 344 KB | Output is correct |
5 | Correct | 3 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 344 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 344 KB | Output is correct |
3 | Correct | 4 ms | 344 KB | Output is correct |
4 | Correct | 2 ms | 344 KB | Output is correct |
5 | Correct | 3 ms | 344 KB | Output is correct |
6 | Correct | 2 ms | 340 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 596 KB | Output is correct |
2 | Correct | 3 ms | 344 KB | Output is correct |
3 | Correct | 3 ms | 344 KB | Output is correct |
4 | Correct | 3 ms | 344 KB | Output is correct |
5 | Correct | 3 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 344 KB | Output is correct |
7 | Correct | 5 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 344 KB | Output is correct |
3 | Correct | 3 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 440 KB | Output is correct |
5 | Correct | 4 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 344 KB | Output is correct |
7 | Correct | 3 ms | 344 KB | Output is correct |