Submission #674255

#TimeUsernameProblemLanguageResultExecution timeMemory
674255vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
10 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> const int mod=1e9+7, maxn=1e5+5; int n, c[maxn], x, ki, ka, mid, res; vector<int> v; bool baru[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; v.pb(1); c[1]=1; for(int i=2; i<=n; i++) { cout << v.size()+1 << ' '; for(auto x:v) cout << x << ' '; cout << i << endl; cin >> x; if(x>v.size()) baru[i]=true, v.pb(i), c[i]=v.size(); } for(int i=2; i<=n; i++) { if(baru[i]) continue; ki=0, ka=v.size()-1; while(ki<=ka) { mid=(ki+ka)/2; cout << mid+2 << ' '; for(int i=0; i<=mid; i++) cout << v[i] << ' '; cout << i << endl; cin >> x; if(x==mid+2) ki=mid+1; else res=mid, ka=mid-1; } c[i]=c[v[res]]; } cout << "0 "; for(int i=1; i<=n; i++) cout << c[i] << ' '; cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:24:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   if(x>v.size()) baru[i]=true, v.pb(i), c[i]=v.size();
      |      ~^~~~~~~~~
#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...