Submission #74446

#TimeUsernameProblemLanguageResultExecution timeMemory
74446shoemakerjoCarnival (CEOI14_carnival)C++14
100 / 100
10 ms584 KiB
#include <bits/stdc++.h> using namespace std; #define maxn 155 int N; int ans[maxn]; vector<int> oq; int query(vector<int> stuff, int val) { cout << stuff.size() + 1 << " "; for (int vv : stuff) cout << vv << " "; cout << val << endl; int ss ; cin >> ss; return ss; } int main() { cin >> N; ans[1] = 1; oq.push_back(1); for (int i = 2; i <= N; i++) { int cur = query(oq, i); if (cur == oq.size()+1) { ans[i] = oq.size()+1; oq.push_back(i); continue; } int l = 0; int r= oq.size()-1; while (l != r) { int mid = (l+r)/2; vector<int> vc; for (int i = l; i <= mid; i++) { vc.push_back(oq[i]); } int cans = query(vc, i); if (cans == vc.size()) { //match is in here r = mid; } else { l = mid+1; } } // cout << i << " " << "l: " << l << endl; ans[i] = ans[oq[l]]; } cout << 0; for (int i = 1; i <= N; i++) { cout << " " << ans[i]; } cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:27:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (cur == oq.size()+1) {
       ~~~~^~~~~~~~~~~~~~
carnival.cpp:41:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (cans == vc.size()) { //match is in here
        ~~~~~^~~~~~~~~~~~
#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...