Submission #52058

#TimeUsernameProblemLanguageResultExecution timeMemory
52058Alexa2001Carnival (CEOI14_carnival)C++17
100 / 100
20 ms572 KiB
#include <bits/stdc++.h> using namespace std; /// 15:08 const int Nmax = 155; int n, i, x, C=0, a[Nmax], cnt[Nmax]; int bs(int id) { int st, dr, mid, x, j; st = 1, dr = id-1; while(st <= dr) { mid = (st+dr)/2; cout << mid+1 << ' '; for(j=1; j<=mid; ++j) cout << j << ' '; cout << id << '\n'; fflush(stdout); cin >> x; if(x != cnt[mid]) st = mid+1; else dr = mid-1; } return a[st]; } int main() { cin >> n; for(i=1; i<=n; ++i) { x = bs(i); if(x) a[i] = x; else a[i] = ++C; cnt[i] = C; } cout << 0; for(i=1; i<=n; ++i) cout << ' ' << a[i]; cout << '\n'; 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...