# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752661 | beaconmc | Carnival (CEOI14_carnival) | C++14 | 10 ms | 448 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |