Submission #475700

#TimeUsernameProblemLanguageResultExecution timeMemory
475700ZaZo_Carnival (CEOI14_carnival)C++14
0 / 100
7 ms200 KiB
#include <bits/stdc++.h> #define HID ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long #define all(v) v.begin(),v.end() const int N = 2010 , INF = 1e15; using namespace std; int n , x , all; int ans[160] = {0}; int check(vector<int>v) { cout<<v.size()<<" "; for(int i = 0 ; i < v.size() ; i++) cout<<v[i]<<" "; cout<<endl; cin >> x; return x; } int num=2; int32_t main() { //HID cin >> n; vector<int>in; ans[1]=1; in.push_back(1); for(int i = 2 ; i <= n ; i++) { in.push_back(i); if(check(in) == in.size()) ans[i] = in.size(); else { in.pop_back(); int l = 0 , r = in.size()-1 , cur=-1; while(l<r) { int mid = (l+r)/2; vector<int>out; for(int j = 0 ; j <= mid ; j++) out.push_back(in[j]); out.push_back(i); if(check(out) == out.size()-1) r = mid-1 , cur = mid; else l = mid+1; } //cout<<i <<"!"<< in[cur]<<endl; if(cur!=-1) { if(ans[in[cur]]==0 && ans[i]==0) ans[i] = ans[in[cur]] = num , num++; else if(ans[in[cur]]!=0) ans[i] = ans[in[cur]]; else if(ans[i]!=0) ans[in[cur]] = ans[i]; } else ans[i] = num , num++; } } cout<<"0 "; for(int i = 1 ; i <= n ; i++) cout<<ans[i]<<" "; }

Compilation message (stderr)

carnival.cpp: In function 'long long int check(std::vector<long long int>)':
carnival.cpp:12:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for(int i = 0 ; i < v.size() ; i++) cout<<v[i]<<" ";
      |                   ~~^~~~~~~~~~
carnival.cpp: In function 'int32_t main()':
carnival.cpp:27:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     if(check(in) == in.size()) ans[i] = in.size();
      |        ~~~~~~~~~~^~~~~~~~~~~~
carnival.cpp:38:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(check(out) == out.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...