Submission #709960

#TimeUsernameProblemLanguageResultExecution timeMemory
709960vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
13 ms316 KiB
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/trie_policy.hpp> // #include <ext/rope> using namespace std; // using namespace __gnu_cxx; // using namespace __gnu_pbds; void Hollwo_Pelw(); signed main(){ #ifndef hollwo_pelw_local if (fopen(".inp", "r")) assert(freopen(".inp", "r", stdin)), assert(freopen(".out", "w", stdout)); #else using namespace chrono; auto start = steady_clock::now(); #endif cin.tie(0), cout.tie(0) -> sync_with_stdio(0); int testcases = 1; // cin >> testcases; for (int test = 1; test <= testcases; test++){ // cout << "Case #" << test << ": "; Hollwo_Pelw(); } #ifdef hollwo_pelw_local auto end = steady_clock::now(); cout << "\nExecution time : " << duration_cast<milliseconds> (end - start).count() << "[ms]" << endl; #endif } int n, ans[200], col[200]; int query(int i, int t = -1){ cout << i + (t > 0) << ' '; for (int j = 1; j <= i; j++) cout << j << ' '; if (t > 0) cout << t << ' '; cout << endl; int x; cin >> x; return x; } void Hollwo_Pelw(){ cin >> n; ans[1] = col[1] = 1; int cnt = 1; for (int i = 2; i <= n; i++){ int x = query(i); if (x > cnt){ col[i] = col[i-1] + 1; ans[i] = ++cnt; }else{ col[i] = col[i-1]; int l = 1, r = i-1; while (l < r){ int mid = (l+r)/2; int g = query(mid, i); if (g == col[mid]) r = mid; else l = mid + 1; } ans[i] = ans[l]; } } cout << "0 "; for (int i = 1; i <= n; i++) cout << ans[i] << ' '; }
#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...