Submission #995926

#TimeUsernameProblemLanguageResultExecution timeMemory
995926vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
6 ms596 KiB
#include<bits/stdc++.h> #define ll long long #define all(v) begin(v), end(v) #define pi pair<int, int> #define vi vector<int> using namespace std; int n, id[155] = {0, 1}; vector<int> rf; int main(){ cin >> n; int prev = 1, k; rf.push_back(1); for(int i = 2; i <= n; i++){ cout << i << " "; for(int j = 1; j <= i; j++) cout << j << " "; cout << endl; cin >> k; if(k > prev){ prev = k; rf.push_back(i); id[i] = prev; } } for(int i = 1; i <= n; i++){ if(id[i]) continue; int l = 0, r = rf.size() - 1, mid; while(l<=r){ mid = (l+r)>>1; cout << mid+2 << " " << i << " "; for(int i = 0; i <= mid; i++) cout << rf[i] << " "; cout << "\n"; cin >> k; if(k < mid+2) r = mid-1; else l = mid+1; } id[i] = id[rf[l]]; } cout << 0 << " "; for(int i = 1; i <= n; i++) cout << id[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...