Submission #909810

#TimeUsernameProblemLanguageResultExecution timeMemory
909810vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
4 ms496 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; vector <ll> ans; int main () { ll n; cin >> n; ans.resize(n); vector <ll> diff; diff.push_back(0); ll curColor = 0; ans[0] = curColor++; for (ll i = 1; i < n; i++) { cout << diff.size()+1 << ' '; for (ll j : diff) cout << j+1 << ' '; cout << i+1 << '\n'; ll res; cin >> res; if (res == diff.size()+1) { diff.push_back(i); ans[i] = curColor++; continue; } ll l = 0, r = diff.size(); while (l+1 < r) { ll mid = (l+r)>>1; cout << mid+1 << ' '; for (ll j = 0; j < mid; j++) cout << diff[j]+1 << ' '; cout << i+1 << '\n'; ll res; cin >> res; if (res == mid) { r = mid; } else { l = mid; } } ans[i] = ans[diff[l]]; } cout << "0 "; for (ll i : ans) cout << i+1 << ' '; cout << '\n'; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:21:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if (res == diff.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...