Submission #750892

#TimeUsernameProblemLanguageResultExecution timeMemory
750892vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
15 ms208 KiB
#include <bits/stdc++.h> using namespace std; const int NM = 150; int N, a[NM+5], k, pos[NM+5]; int ask(int t, int i){ cout << t+1 << ' '; for (int j = 1; j <= t; j++) cout << pos[j] << ' '; cout << i << endl; int res; cin >> res; return res; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; a[k = 1] = 1; pos[1] = 1; for (int i = 2; i <= N; i++){ int L = 1, R = k, j = -1; while (L <= R){ int mid = (L+R)/2; if (ask(mid, i) == mid){ j = mid; R = mid-1; } else L = mid+1; } if (j == -1){ a[i] = ++k; pos[k] = i; } else{ a[i] = j; } } cout << 0 << ' '; for (int i = 1; i <= N; i++) cout << a[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...