Submission #245831

#TimeUsernameProblemLanguageResultExecution timeMemory
245831minhcoolCarnival (CEOI14_carnival)C++17
100 / 100
14 ms512 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pb push_back #define ins insert #define er erase typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int oo = 1e18 + 7, mod = 1e9 + 7; int n, color[155]; vector<int> arr; signed main(){ ios_base::sync_with_stdio(0); cin >> n; arr.pb(1); color[1] = 1; for(int i = 2; i <= n; i++){ cout << arr.size() + 1 << " "; for(int j = 0; j < arr.size(); j++) cout << arr[j] << " "; cout << i << "\n"; int ans; cin >> ans; if(ans == arr.size() + 1){ arr.pb(i); color[i] = arr.size(); continue; } int l = 0, r = arr.size() - 1; while(l != r){ int mid = (l + r) >> 1; //cout << l << " " << r << " " << mid << "\n"; cout << mid - l + 2 << " "; for(int j = l; j <= mid; j++) cout << arr[j] << " "; cout << i << "\n"; int ans; cin >> ans; if(ans > (mid - l + 1)){ //cout << 1 << " "; l = mid + 1; } else{ r = mid; //cout << 2 << " "; } //cout << l << " " << r << "\n"; } color[i] = l + 1; } cout << 0 << " "; for(int i = 1; i <= n; i++) cout << color[i] << " "; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:27:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0; j < arr.size(); j++) cout << arr[j] << " ";
                     ~~^~~~~~~~~~~~
carnival.cpp:31:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(ans == arr.size() + 1){
         ~~~~^~~~~~~~~~~~~~~~~
#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...