Submission #754866

#TimeUsernameProblemLanguageResultExecution timeMemory
754866colossal_pepeCarnival (CEOI14_carnival)C++17
100 / 100
12 ms208 KiB
#include <iostream> #include <vector> using namespace std; int n; vector<int> rep, c; int query(int l, int r) { cout << r - l + 1 << ' '; for (int i = l; i <= r; i++) { cout << rep[i] << ' '; } cout << endl; int ret; cin >> ret; return ret; } int twin() { int lo = 0, hi = rep.size() - 1; while (hi - lo > 1) { int mid = (hi + lo) / 2; if (query(mid, rep.size() - 1) < rep.size() - mid) lo = mid; else hi = mid - 1; } if (query(hi, rep.size() - 1) < rep.size() - hi) return hi; return lo; } int main() { cin >> n; c.resize(n + 1); for (int i = 1; i <= n; i++) { rep.push_back(i); if (query(0, rep.size() - 1) == rep.size()) { c[i] = rep.size(); continue; } c[i] = c[rep[twin()]]; rep.pop_back(); } cout << 0 << ' '; for (int i = 1; i <= n; i++) { cout << c[i] << ' '; } cout << endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int twin()':
carnival.cpp:23:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if (query(mid, rep.size() - 1) < rep.size() - mid) lo = mid;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
carnival.cpp:26:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     if (query(hi, rep.size() - 1) < rep.size() - hi) return hi;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:35:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if (query(0, rep.size() - 1) == rep.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...