Submission #908828

#TimeUsernameProblemLanguageResultExecution timeMemory
908828vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
6 ms596 KiB
#include <bits/stdc++.h> using namespace std; void invita (const vector<int> &v, int otro) { cout << v.size()+1 << " "; for (int x: v) cout << x << " "; cout << otro << endl; } int color[155]; void solve() { int n, x; cin >> n; vector<int> p = {1}; color[1] = 1; for (int i = 2; i <= n; i++) { invita(p, i); cin >> x; if(x==1){ color[i]=color[1]; continue; } if (x > p.size()) { p.push_back(i); color[i] = p.size(); continue; } int l = 0, r = p.size()-1; int aux = 0; while (l <= r) { int mit = (l+r) >> 1; vector<int> temp; for (int j = aux; j <= mit; j++) temp.push_back(p[j]); invita(temp, i); cin >> x; if(x==1){ color[i]=color[temp[0]]; break; } if (x == temp.size()) { r = mit; continue; } l = mit+1; aux = l; } // color[i] = l; } cout << "0 "; for (int i = 1; i <= n; i++) cout << color[i] << " "; cout << endl; } int main() { int t = 1; //cin >> t; while (t--) solve(); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'void solve()':
carnival.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   if (x > p.size())
      |       ~~^~~~~~~~~~
carnival.cpp:44:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |    if (x == temp.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...