Submission #445803

#TimeUsernameProblemLanguageResultExecution timeMemory
445803JovanBCarnival (CEOI14_carnival)C++17
100 / 100
10 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; int col[155]; vector <int> vec; void trazi(int l, int r, int k){ if(l == r){ col[k] = col[vec[l]]; return; } int mid = (l+r)/2; cout << mid-l+2 << " "; for(int i=l; i<=mid; i++){ cout << vec[i] << " "; } cout << k << endl; int x; cin >> x; if(x != mid-l+2) trazi(l, mid, k); else trazi(mid+1, r, k); } int main(){ ios_base::sync_with_stdio(false); cout.precision(10); cout<<fixed; int n; cin >> n; col[1] = 1; vec.push_back(1); for(int i=2; i<=n; i++){ cout << vec.size() + 1 << " "; for(auto c : vec) cout << c << " "; cout << i << endl; int x; cin >> x; if(x > vec.size()){ col[i] = vec.size() + 1; vec.push_back(i); continue; } trazi(0, vec.size()-1, i); } cout << "0 "; for(int i=1; i<=n; i++) cout << col[i] << " "; cout << endl; return 0; }

Compilation message (stderr)

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