Submission #674269

#TimeUsernameProblemLanguageResultExecution timeMemory
674269groshiCarnival (CEOI14_carnival)C++17
100 / 100
12 ms208 KiB
#include<iostream> using namespace std; int jaki[200]; int ost=2; int bylo[200]; int rozne(int x,int y) { for(int i=0;i<=150;i++) bylo[i]=0; int wynik=0; for(int i=x;i<=y;i++) { if(bylo[jaki[i]]) continue; wynik++; bylo[jaki[i]]=1; } return wynik; } int32_t main() { //ios_base::sync_with_stdio(0); //cin.tie(0); ///cout.tie(0); int n,odp; cin>>n; jaki[1]=1; for(int i=2;i<=n;i++) { int pocz=1,kon=i,sre,ostd; cout<<i<<" "; for(int j=1;j<=i;j++) cout<<j<<" "; cout<<"\n"; cin>>odp; if(odp==ost) { jaki[i]=ost; ost++; continue; } while(pocz<kon) { sre=(pocz+kon)/2; cout<<sre-pocz+2<<" "; for(int j=pocz;j<=sre;j++) cout<<j<<" "; cout<<i<<"\n"; cin>>odp; if(odp==rozne(pocz,sre)) kon=sre; else pocz=sre+1; } jaki[i]=jaki[pocz]; } cout<<"0 "; for(int i=1;i<=n;i++) cout<<jaki[i]<<" "; cout<<"\n"; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int32_t main()':
carnival.cpp:31:30: warning: unused variable 'ostd' [-Wunused-variable]
   31 |         int pocz=1,kon=i,sre,ostd;
      |                              ^~~~
#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...