Submission #595625

#TimeUsernameProblemLanguageResultExecution timeMemory
595625someoneCarnival (CEOI14_carnival)C++14
100 / 100
10 ms336 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int N = 2e5 + 42, INF = 1e18; vector<int> id; int n, curDiff = 1, grp[N]; int getNbDiff(int deb, int fin, int cible) { cout << fin - deb + 1 << ' ' << cible+1; for(int j = deb; j < fin; j++) cout << ' ' << id[j] + 1; cout << '\n'; cout.flush(); int ans; cin >> ans; return ans; } void dicho(int deb, int fin, int cible) { if(deb + 1 == fin) { grp[cible] = grp[id[deb]]; return; } int mid = (deb + fin) >> 1; if(getNbDiff(deb, mid, cible) == mid - deb) dicho(deb, mid, cible); else dicho(mid, fin, cible); } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; id.push_back(0); for(int i = 1; i < n; i++) { int ans = getNbDiff(0, curDiff, i); if(ans == curDiff+1) { grp[i] = curDiff; curDiff++; id.push_back(i); } else { dicho(0, curDiff, i); } } cout << 0; for(int i = 0; i < n; i++) cout << ' ' << grp[i]+1; cout.flush(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...