Submission #1086498

#TimeUsernameProblemLanguageResultExecution timeMemory
1086498vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
5 ms436 KiB
#include <bits/stdc++.h> using namespace std; int n; vector<int> v; int tip[200]; int prasaj(int l,int r,int b) { l--; cout<<r-l+1<<" "; for (int i=l;i<r;i++){ cout<<v[i]<<" "; } cout<<b<<endl; int x; cin>>x; return x; } int bs(int l,int r,int t) { //cout<<"l="<<l<<" r="<<r<<" t="<<t<<endl; if (l==r) return l; int mid = (l+r)/2; int y = prasaj(l,mid,t); if (y==mid-l+1) return bs(l,mid,t); else return bs(mid+1,r,t); } int main() { cin>>n; v.push_back(1); tip[1] = 1; for (int i=2;i<=n;i++) { int x = prasaj(1,v.size(),i); if (x == v.size()+1) { v.push_back(i); tip[i] = v.size(); } } for (int i=1;i<=n;i++) { if (tip[i]==0) { int x=bs(1,v.size(),i); tip[i]=x; } } cout<<"0 "; for (int i=1;i<=n;i++) cout<<tip[i]<<" "; cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if (x == v.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...