Submission #657339

#TimeUsernameProblemLanguageResultExecution timeMemory
657339Ronin13Carnival (CEOI14_carnival)C++14
100 / 100
37 ms208 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back using namespace std; int GetDif(int l, int r){ cout << r - l + 1 << " "; for(int i= l; i <= r; i++){ cout << i << ' '; } cout << "\n"; cout.flush(); int x; cin >> x; return x; } int main(){ int n; cin >> n; int c[n + 1]; fill(c + 1, c + n + 1, 0); int cur = 1; for(int i= 1;i <= n; i++){ if(c[i] == 0)c[i] = cur++; int l = i , r = n + 1; while(l + 1< r){ int mid = (l + r) / 2; int v = GetDif(i, mid); int u = GetDif(i + 1, mid); if(u == v) r = mid; else l = mid; } if(r != n + 1) c[r] = c[i]; } cout << 0 << ' '; for(int i = 1; i <= n; i++){ cout << c[i] << ' '; } 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...