Submission #590670

#TimeUsernameProblemLanguageResultExecution timeMemory
590670MounirCarnival (CEOI14_carnival)C++14
100 / 100
9 ms336 KiB
#include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define pb push_back #define pii pair<int, int> #define chmin(x, v) x = min(x, v) #define chmax(x, v) x = max(x, v) #define print(x) cout << #x << " est " << x << endl; #define x first #define y second #define int long long using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int nAmis; cin >> nAmis; vector<int> costumes(nAmis + 1, -1); vector<int> distincts = {1}; costumes[1] = 1; for (int iAmi = 2; iAmi <= nAmis; ++iAmi){ cout << sz(distincts) + 1 << endl; for (int distinct : distincts) cout << distinct << " "; cout << iAmi << endl; int nDiff; cin >> nDiff; if (nDiff != sz(distincts)){ costumes[iAmi] = sz(distincts) + 1; distincts.pb(iAmi); } else { int deb = 0, fin = sz(distincts) - 1; while (fin > deb){ int mid = (deb + fin)/2; vector<int> tests = {iAmi}; for (int i = deb; i <= mid; ++i) tests.pb(distincts[i]); cout << sz(tests) << endl; for (int test : tests) cout << test << " "; cout << endl; cin >> nDiff; if (nDiff != sz(tests)) fin = mid; else deb = mid + 1; } costumes[iAmi] = costumes[distincts[deb]]; } } cout << 0 << " "; for (int i = 1; i <= nAmis; ++i) cout << costumes[i] << " "; cout << endl; return 0; }
#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...