Submission #600101

#TimeUsernameProblemLanguageResultExecution timeMemory
600101MasterTasterCarnival (CEOI14_carnival)C++14
100 / 100
18 ms344 KiB
#include <iostream> #include <vector> #define pb push_back #define MAXN 155 using namespace std; int n, prosli[MAXN], ress[MAXN]; vector<int> novi; bool check(int k, int i) { cout<<k+1<<" "; for (int j=0; j<=k; j++) cout<<novi[j]<<" "; cout<<endl; int cnt1; cin>>cnt1; cout<<k+2<<" "; for (int j=0; j<=k; j++) cout<<novi[j]<<" "; cout<<i<<endl; int cnt2; cin>>cnt2; return (cnt1==cnt2); } int main() { cin>>n; int cnt=1; novi.pb(1); for (int i=2; i<=n; i++) { vector<int> sta; for (int j=1; j<=i; j++) sta.pb(j); cout<<sta.size()<<" "; for (int i=0; i<sta.size(); i++) cout<<sta[i]<<" "; cout<<endl; int tren; cin>>tren; if (tren>cnt) { prosli[i]=0; cnt=tren; novi.pb(i); } else { int l=0, r=novi.size()-1, gde=-1; while (l<=r) { int mid=l+(r-l)/2; if (check(mid, i)) { r=mid-1; gde=mid; } else l=mid+1; } prosli[i]=novi[gde]; } } int col=1; for (int i=1; i<=n; i++) { if (prosli[i]==0) { ress[i]=col++; } else ress[i]=ress[prosli[i]]; } cout<<0<<" "; for (int i=1; i<=n; i++) cout<<ress[i]<<" "; cout<<endl; }

Compilation message (stderr)

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