Submission #574931

#TimeUsernameProblemLanguageResultExecution timeMemory
574931birthdaycakeCarnival (CEOI14_carnival)C++17
0 / 100
12 ms5004 KiB
#include<bits/stdc++.h> #define int long long #define mod 1000000007 using namespace std; vector<int>adj[200001]; int vs[151]; int c; void dfs(int x){ vs[x] = c; for(auto s:adj[x]){ if(!vs[s]){ vs[s] = c; dfs(s); } } } signed main(){ int n; cin >> n; for(int i = 0; i < n; i++){ int l = i, r = n - 1, aa = -1; while(l <= r){ int mid = (l + r) / 2; if(mid - i + 1 == 1){ l = mid + 1; aa = mid + 1; continue; } cout << mid - i + 1 << ' ' ; for(int j = i; j <= mid; j++){ cout << j + 1 << ' '; } cout << endl; int ans; cin >> ans; if(ans == mid - l + 1){ l = mid + 1; aa = mid + 1; }else{ r = mid - 1; } } if(aa != -1){ adj[i].push_back(aa); } } for(int i = 0; i < n; i++){ if(!vs[i]){ c++; dfs(i); } } cout << 0 << ' ' ; for(int i = 0; i < n;i++){ cout << vs[i] << ' '; } cout << endl; 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...