Submission #918172

#TimeUsernameProblemLanguageResultExecution timeMemory
918172nasir_bashirovCarnival (CEOI14_carnival)C++11
0 / 100
7 ms1976 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define db long double #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> // #define endl '\n' #define all(x) x.begin(), x.end() #define fastio\ ios_base::sync_with_stdio(0);\ cin.tie(0);\ cout.tie(0)\ mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); map<vi, int> mp; int ask(vi &v){ if(mp[v]) return mp[v]; cout << v.size() << " "; for(int i : v){ cout << i << " "; } cout << endl; int x; cin >> x; return mp[v] = x; } signed main(){ int n; cin >> n; int a[n + 5], pre = 0; vi v; for(int i = 1; i <= n; i++){ v.push_back(i); int k = ask(v); if(k > pre){ a[i] = k; pre = k; } else{ int l = 1, r = i - 1, ans = -1; while(l < r){ int mid = (l + r) / 2; vi tmp; for(int i = 1; i <= mid; i++){ tmp.push_back(i); } int pre = ask(tmp); tmp.push_back(i); int nw = ask(tmp); if(nw == pre){ ans = mid; r = mid - 1; } else{ l = mid + 1; } } a[i] = a[ans]; } } cout << 0 << " "; for(int i = 1; i <= n; i++){ cout << a[i] << " "; } 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...