Submission #110508

#TimeUsernameProblemLanguageResultExecution timeMemory
110508Mahdi_JfriCarnival (CEOI14_carnival)C++14
100 / 100
20 ms504 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 150 + 20; int c[maxn] , id = 1; int cnt(int l , int r) { vector<int> tmp; for(int i = l; i < r; i++) tmp.pb(c[i]); sort(tmp.begin() , tmp.end()); return unique(tmp.begin() , tmp.end()) - tmp.begin(); } int ask(int l , int r) { cout << r - l + 1 << " "; for(int i = l; i <= r; i++) cout << i + 1 << " "; cout << endl; int x; cin >> x; return x; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i = 1; i < n; i++) { int L = 0 , R = i; if(ask(0 , i) != cnt(0 , i)) { c[i] = id++; continue; } while(R - L > 1) { int m = (L + R) / 2; if(ask(m , i) != cnt(m , i)) R = m; else L = m; } c[i] = c[L]; } cout << 0 << " "; for(int i = 0; i < n; i++) cout << c[i] + 1 << " "; cout << endl; }
#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...