Submission #579143

#TimeUsernameProblemLanguageResultExecution timeMemory
579143Jarif_RahmanCarnival (CEOI14_carnival)C++17
100 / 100
51 ms312 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int ask(vector<int> s){ cout << s.size() << " "; for(int x: s) cout << x << " "; cout << "\n"; int x; cin >> x; return x; } int main(){ setbuf(stdout, NULL); int n; cin >> n; int c = 0; vector<int> ans(n), s; for(int i = 1; i <= n; i++){ s.pb(i); if(ask(s) != c){ c++; ans[i-1] = c; continue; } s.pop_back(); int a = 0, b = c-1; while(a < b){ int md = (a+b)/2; vector<int> ss(s.begin(), s.begin()+md+1); ss.pb(i); if(ask(ss) == ss.size()) a = md+1; else b = md; } ans[i-1] = a+1; } cout << "0 "; for(int x: ans) cout << x << " "; cout << "\n"; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:39:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if(ask(ss) == ss.size()) a = md+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...