Submission #918526

#TimeUsernameProblemLanguageResultExecution timeMemory
918526vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
8 ms1508 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define pb push_back #define f first #define s second using namespace std; using namespace __gnu_pbds; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; map<vl, ll>mp; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tests = 1; //cin >> tests; while(tests--) { ll n, i, j, k = 0; cin >> n; ll ans[n+5]; vl v; for(i = 1; i <= n; i++){ v.pb(i); ll a; if(mp[v]) a = mp[v]; if(!mp[v]) { cout << v.size() << ' '; for(auto u : v) cout << u << ' '; cout << endl; cin >> a; mp[v] = a; } if(a <= k) { v.pop_back(); ll l = 0, r = (ll)v.size() - 1; while(l < r) { ll mid = (l + r) / 2; vl vv; for(j = 0; j <= mid; j++) vv.pb(v[j]); cout << vv.size() << ' '; for(auto u : vv) cout << u << ' '; cout << endl; ll a1; cin >> a1; vv.pb(i); cout << vv.size() << ' '; for(auto u : vv) cout << u << ' '; cout << endl; ll a2; cin >> a2; if(a2 > a1) l = mid + 1; else r = mid; } ans[i] = ans[v[l]]; } else if(a > k) { k = a; ans[i] = k; } } cout << 0 << ' '; for(i = 1; i <= n; i++) cout << ans[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...