Submission #574968

#TimeUsernameProblemLanguageResultExecution timeMemory
574968RifalCarnival (CEOI14_carnival)C++14
0 / 100
1 ms316 KiB
#include <bits/stdc++.h> //#include <fstream> ///#define endl '\n' #define mod 10007 #define INF 100000000 #define ll long long //ofstream fout("split.out"); //ifstream fin("split.in"); //#define cin fin //#define cout fout using namespace std; int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n; cin >> n; int ans[n+1] = {}; int cnt = 1; vector<int> v; int y; cout << 2 << ' ' << 1 << ' ' << 2 << endl; cin >> y; if(y == 1) { ans[1] = cnt; ans[2] = cnt; cnt++; v.push_back(1); } else { ans[1] = 1; ans[2] = 2; cnt += 2; v.push_back(1); v.push_back(2); } for(int i = 3; i <= n; i++) { int l = 0, r = v.size()-1; while(l <= r) { int mid = (l+r-1)/2; cout << l << ' ' << r << ' ' << mid << 'k' << endl; int a = -1, b = -1; if(mid-l+1 != 0) { cout << mid-l+2 << ' '; for(int j = l; j <= mid; j++) { cout << v[j] << ' '; } cout << i << ' '; cout << endl; cin >> a; } if(r-mid != 0) { cout << r-mid+1 << ' '; for(int j = mid+1; j <= r; j++) { cout << v[j] << ' '; } cout << i << ' '; cout << endl; cin >> b; } if(a == mid-l+1) { if(mid-l+1 == 1) { ans[i] = ans[v[mid]]; break; } r = mid; } else if(b == r-mid) { if(r-mid == 1) { ans[i] = ans[v[mid]]; break; } l = mid+1; } else { ans[i] = cnt; cnt++; v.push_back(i); break; } } } cout << 0 << ' '; for(int i = 1; i <= n; i++) { cout << ans[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...