Submission #587122

#TimeUsernameProblemLanguageResultExecution timeMemory
587122ygimCarnival (CEOI14_carnival)C++17
100 / 100
7 ms320 KiB
// P1_Carnival.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <vector> #include <algorithm> #include <climits> #include <math.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pii> vp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; vp groups; vi costumes(n, -1); int c = 1; groups.push_back({ 0, 1 }); costumes[0] = 1; for (int i = 1; i < n; i++) { cout << groups.size() + 1 << " "; for (pii p : groups) cout << p.first + 1 << " "; cout << i + 1 << endl; int t; cin >> t; if (t == groups.size()) { int l = 0, r = groups.size() - 1, mid = (l+r)/2; while (l < r) { mid = (l + r) / 2; cout << mid - l + 2 << " "; for (int j = l; j <= mid; j++) cout << groups[j].first + 1 << " "; cout << i + 1 << endl; int t; cin >> t; if (t == mid - l + 2) l = mid + 1; else r = mid; } costumes[i] = groups[l].second; } else { groups.push_back({ i, ++c }); costumes[i] = c; } } cout << 0 << " "; for (int i : costumes) cout << i << " "; cout << endl; }

Compilation message (stderr)

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