Submission #874803

#TimeUsernameProblemLanguageResultExecution timeMemory
874803eu_caueCarnival (CEOI14_carnival)C++14
100 / 100
5 ms848 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 155; int pai[maxn], peso[maxn], colors[maxn]; vector<int> heads; int query(int tl, int tr, int i){ if(tl == tr) return heads[tl]; int mid = (tl+tr)>>1; cout << mid - tl + 2 << ' '; cout << i << ' '; for(int j = tl; j <= mid; j++) cout << heads[j] << ' '; cout << endl; int ans; cin >> ans; if(ans == mid-tl+1) return query(tl, mid, i); return query(mid+1, tr, i); } int main(){ int n; cin >> n; int color = 1; for(int i = 1; i <= n; i++) pai[i] = i; for(int i = 1; i <= n; i++){ cout << heads.size()+1 << ' '; cout << i << ' '; for(int k : heads) cout << k << ' '; cout << endl; int ans; cin >> ans; if(ans == heads.size()+1){ colors[i] = color; color++; heads.push_back(i); continue; } pai[i] = query(0, heads.size(), i); } for(int i = 0; i <= n; i++) cout << colors[pai[i]] << ' '; cout << endl; return 0; }

Compilation message (stderr)

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