Submission #1015913

#TimeUsernameProblemLanguageResultExecution timeMemory
1015913vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
14 ms856 KiB
#include <bits/stdc++.h> using namespace std; #define int long long // #define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define nl "\n" vector<int> vec(int start, int end){ vector<int> v; for (int i=start; i<=end; i++) v.push_back(i); return v; } int query(int k, vector<int> v){ cout << k << " "; for (auto i : v) cout << i << " "; cout << endl; int c; cin >> c; return c; } void answer(vector<int> v){ cout << "0 "; for (auto i : v) cout << i << " "; cout << endl; } signed main(){ int n; cin >> n; vector<int> costumes; // set person 1 to have costume 1 int curmax = 1; costumes.push_back(1); for (int i=2; i<=n; i++){ //for person i int lower = 1, upper = i-1; while(upper-lower>0){ int mid = (lower+upper)/2; vector<int> to_query = vec(lower, mid); to_query.push_back(i); if(query(mid-lower+1, vec(lower, mid))==query(mid-lower+2, to_query)) upper = mid; else lower = mid+1; } vector<int> too_query; too_query.push_back(i); too_query.push_back(lower); if(query(2, too_query)==1) costumes.push_back(costumes[lower-1]); else{ costumes.push_back(curmax+1); curmax++; } } answer(costumes); 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...