Submission #743388

#TimeUsernameProblemLanguageResultExecution timeMemory
743388NintsiChkhaidzeCarnival (CEOI14_carnival)C++17
0 / 100
4 ms208 KiB
#include <bits/stdc++.h> #define ll long long #define s second #define pb push_back #define f first using namespace std; const int N = 155; int a[N],c[N]; bool f[N]; signed main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); int n; cin>>n; int m = 1; a[1] = 1; f[1] = 1; for (int i = 2; i <= n; i++){ cout<<m + 1<<" "; for (int j = 1; j <= m; j++) cout<<a[j]<<" "; cout<<i<<endl; int k; cin>>k; if (k == m + 1){ ++m; a[m] = i; f[i] = 1; } } for (int i = 1; i <= m; i++) c[a[i]] = i; for (int i = 2; i <= n; i++){ if (f[i]) continue; int res=0,l = 1,r = m; while (l <= r){ int mid = (l + r)>>1; if (l == r){ res=a[l]; break; } cout<<mid + 1<<" "; for (int j = l; j <= mid; j++) cout<<a[j]<<" "; cout<<i<<endl; int k; cin>>k; if (k == mid + 1){ l = mid + 1; }else{ r = mid; } } c[i] = c[a[res]]; } cout<<0<<" "; for (int i = 1; i <= n; i++) cout<<c[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...