Submission #693617

#TimeUsernameProblemLanguageResultExecution timeMemory
693617ojuzuser12Carnival (CEOI14_carnival)C++17
100 / 100
28 ms300 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, C = 0; cin >> N; vector<int> costume(N + 1, -1); for(int i = 1; i <= N; i++) { if(costume[i] == -1) { C++; costume[i] = C; } int l = i + 1, r = N, mid, pos = N + 1; while(l <= r) { mid = (l + r) / 2; cout << (mid - i + 1); for(int j = i; j <= mid; j++) { cout << ' ' << j; } cout << '\n'; cout.flush(); int a; cin >> a; cout << (mid - i); for(int j = i + 1; j <= mid; j++) { cout << ' ' << j; } cout << '\n'; cout.flush(); int b; cin >> b; if(a == b) { pos = min(pos, mid); r = mid - 1; } else { l = mid + 1; } } if(pos != N + 1) { costume[pos] = costume[i]; } } cout << 0; for(int i = 1; i <= N; i++) { cout << ' ' << costume[i]; } cout << '\n'; }
#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...