# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752661 | 2023-06-03T11:38:27 Z | beaconmc | Carnival (CEOI14_carnival) | C++14 | 10 ms | 448 KB |
#include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for (ll i = (x); i < (y); i++) using namespace std; // cd "/home/s/saco06/Desktop/" && g++ carnival.cpp -o carnival && "/home/s/saco06/Desktop/"carnival ll query(vector<ll> q){ cout << q.size() << " "; for (auto&i : q){ cout << i << " "; } ll resp; cin >> resp; return resp; } int main(){ ll n; cin >> n; vector<vector<ll>> stuff; ll cur = 0; vector<ll> buff; vector<ll> unused; FOR(i,0,n){ buff.push_back(i+1); ll resp = query(buff); if (resp != cur){ cur = resp; stuff.push_back({i+1}); }else{ unused.push_back(i+1); } } for (auto&num : unused){ ll lo = 0; ll hi = stuff.size(); while (lo < hi){ vector<ll> buff; ll mid = (lo+hi+1)/2; FOR(i,lo,mid){ buff.push_back(stuff[i][0]); } buff.push_back(num); ll resp = query(buff); if (resp == buff.size()) lo = mid; else hi = mid-1; } stuff[lo].push_back(num); } map<ll, ll> mapp; FOR(i,0, stuff.size()){ for (auto&j : stuff[i]){ mapp[j] = i; } } cout << 0 << " "; FOR(i,1,n+1){ cout << mapp[i]+1 << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 328 KB | Output is correct |
3 | Correct | 5 ms | 316 KB | Output is correct |
4 | Correct | 3 ms | 336 KB | Output is correct |
5 | Correct | 6 ms | 344 KB | Output is correct |
6 | Correct | 4 ms | 336 KB | Output is correct |
7 | Correct | 6 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 328 KB | Output is correct |
2 | Correct | 10 ms | 320 KB | Output is correct |
3 | Correct | 3 ms | 336 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Correct | 8 ms | 300 KB | Output is correct |
6 | Correct | 8 ms | 304 KB | Output is correct |
7 | Correct | 8 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 336 KB | Output is correct |
2 | Correct | 9 ms | 336 KB | Output is correct |
3 | Correct | 9 ms | 320 KB | Output is correct |
4 | Correct | 4 ms | 336 KB | Output is correct |
5 | Correct | 8 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 208 KB | Output is correct |
7 | Correct | 8 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 344 KB | Output is correct |
2 | Correct | 4 ms | 296 KB | Output is correct |
3 | Correct | 5 ms | 336 KB | Output is correct |
4 | Correct | 3 ms | 336 KB | Output is correct |
5 | Correct | 9 ms | 344 KB | Output is correct |
6 | Correct | 7 ms | 324 KB | Output is correct |
7 | Correct | 8 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 336 KB | Output is correct |
2 | Correct | 9 ms | 324 KB | Output is correct |
3 | Correct | 7 ms | 448 KB | Output is correct |
4 | Correct | 9 ms | 320 KB | Output is correct |
5 | Correct | 9 ms | 336 KB | Output is correct |
6 | Correct | 6 ms | 340 KB | Output is correct |
7 | Correct | 4 ms | 324 KB | Output is correct |