Submission #750438

#TimeUsernameProblemLanguageResultExecution timeMemory
750438vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
40 ms328 KiB
#include<bits/stdc++.h> using namespace std; int n, a[10005]; bool vst[10005]; vector<int> last; int ask(int i){ cout << '?' << " " << i << endl; int pos; cin >> pos; return pos; } int main(){ cin.tie(0)->sync_with_stdio(0); cin >> n; int cnt = 1; a[1] = 1; last.push_back(1); for(int i = 2 ; i <= n ; i++){ cout << i << " " << 1; for(int j = 2 ; j <= i ; j++){ cout << " " << j; } cout << endl; int num; cin >> num; a[i] = num; if(num > cnt){ cnt++; last.push_back(i); } else{ for(int j = 0 ; j < last.size() ; j++){ int v = last[j]; cout << "2 " << v << " " << i << endl; cin >> num; if(num == 1){ last[j] = i; a[i] = j + 1; break; } } } } cout << "0 "; for(int i = 1 ; i <= n ; i++) cout << a[i] << " "; cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:32:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j = 0 ; j < last.size() ; j++){
      |                             ~~^~~~~~~~~~~~~
#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...