Submission #995853

#TimeUsernameProblemLanguageResultExecution timeMemory
995853cowwycowCarnival (CEOI14_carnival)C++17
0 / 100
86 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define name "aaaaaa" using ll = long long; using pii = pair<ll, ll>; void file(){ } const int maxn = 155; int ask(vector<int> a){ cout << a.size() << ' '; for(int i : a){ cout << i << ' '; } cout << endl; int x; cin >> x; return x; } int ans[maxn]; vector<int> b; void solve (){ int n; cin >> n; ans[1] = 1; b.push_back(1); for(int i = 2; i <= n; i++){ vector<int> cur = b; cur.push_back(i); if(ask(cur) == cur.size() + 1){ b.push_back(i); ans[i] = b.size(); }else{ int l = 0, r = b.size() - 1, mid, sus = -1; while(l <= r){ mid = (l + r) / 2; cur.clear(); for(int j = l; j <= mid; l++){ cur.push_back(b[j]); } cur.push_back(i); if(ask(cur) == mid - l + 1){ sus = mid; r = mid - 1; }else{ l = mid + 1; } } ans[i] = ans[b[sus]]; } } cout << 0 << ' '; for(int i = 1; i <= n; i++){ cout << ans[i] << ' '; } } int main(){ file(); solve(); }

Compilation message (stderr)

carnival.cpp: In function 'void solve()':
carnival.cpp:33:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if(ask(cur) == cur.size() + 1){
      |      ~~~~~~~~~^~~~~~~~~~~~~~~~~
#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...