Submission #793035

#TimeUsernameProblemLanguageResultExecution timeMemory
793035vjudge1Carnival (CEOI14_carnival)C++14
100 / 100
7 ms292 KiB
#include <bits/stdc++.h> using namespace std; const int N = 153; vector <int> v; int n, co[N], resp; int cnt = 1, l, r; void proc(int w){ l = 0, r = v.size()-1; while(l < r){ //cout << l << ' ' << r << " ENDPOINTS" << endl; int mid = (l+r)/2; cout << (mid-l+2) << ' '; for (int i = l; i <= mid; i++){ cout << v[i] << ' '; } cout << w << endl; cin >> resp; if (resp == (mid-l+1)){ r = mid; } else { l = mid+1; } } co[w] = co[v[l]]; } int main(){ //ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 1; i <= n; i++){ cout << i << ' '; for (int j = 1; j <= i; j++){ cout << j << ' '; } cout << endl; cin >> resp; if (resp == (int)v.size() + 1){ co[i] = cnt; cnt++; v.push_back(i); } else { proc(i); } } cout << 0 << ' '; for (int i = 1; i <= n; i++){ cout << co[i] << ' '; } }
#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...