Submission #476011

#TimeUsernameProblemLanguageResultExecution timeMemory
476011elgamalsalmanCarnival (CEOI14_carnival)C++14
100 / 100
9 ms292 KiB
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int n, costumes[200]; vi distincts; int main() { //ios_base::sync_with_stdio(0); //cin.tie(0); memset(costumes, -1, sizeof costumes); cin >> n; costumes[1] = 0; distincts = {1}; for (int i = 2; i <= n; i++) { cout << (int)distincts.size() + 1; for (int ele : distincts) cout << ' ' << ele; cout << ' ' << i << endl; int c; cin >> c; if (c == (int)distincts.size() + 1) { costumes[i] = (int)distincts.size(); distincts.push_back(i); } else { // binary search int l = 0, r = (int)distincts.size() - 1; while (l < r) { int mid = (l + r) / 2; cout << mid - l + 2; for (int j = l; j <= mid; j++) cout << ' ' << distincts[j]; cout << ' ' << i << endl; cin >> c; if (c == mid - l + 2) l = mid + 1; else r = mid; } assert(l == r); costumes[i] = l; } } cout << 0; for (int i = 1; i <= n; i++) cout << ' ' << costumes[i] + 1; cout << endl; }
#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...