Submission #918511

# Submission time Handle Problem Language Result Execution time Memory
918511 2024-01-30T03:21:05 Z Aiperiii Carnival (CEOI14_carnival) C++14
100 / 100
6 ms 848 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
   ios_base::sync_with_stdio();
   cin.tie(0);cout.tie(0);
   int n;cin>>n;
   vector <int> vis(n+1);
   vector <int> uniq,v,p;
   for(int i=1;i<=n;i++){
      v.pb(i);
      cout<<v.size()<<" ";
      for(auto x : v)cout<<x<<" ";
      cout<<endl;
      int dt;cin>>dt;
      if(p.size()==0 or dt>p.back()){
         uniq.pb(i);
         vis[i]=uniq.size();
      }
      p.pb(dt);
   }
   for(int i=1;i<=n;i++){
      if(vis[i])continue;
      int l=0,r=uniq.size();
      while(l+1<r){
         int md=(l+r)/2;
         vector <int> v;
         v.pb(i);
         for(int j=md;j<uniq.size();j++){
            v.pb(uniq[j]);
         }
         cout<<v.size()<<" ";
         for(auto x : v)cout<<x<<" ";
         cout<<endl;
         int dt;cin>>dt;
         if(dt==uniq.size()-md+1)r=md;
         else l=md;
      }
      vis[i]=vis[uniq[l]];
   }
   for(int i=0;i<=n;i++)cout<<vis[i]<<" ";
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:33:24: 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]
   33 |          for(int j=md;j<uniq.size();j++){
      |                       ~^~~~~~~~~~~~
carnival.cpp:40:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   40 |          if(dt==uniq.size()-md+1)r=md;
      |             ~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 692 KB Output is correct
2 Correct 4 ms 696 KB Output is correct
3 Correct 3 ms 688 KB Output is correct
4 Correct 2 ms 696 KB Output is correct
5 Correct 2 ms 440 KB Output is correct
6 Correct 2 ms 692 KB Output is correct
7 Correct 4 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 692 KB Output is correct
3 Correct 2 ms 428 KB Output is correct
4 Correct 2 ms 432 KB Output is correct
5 Correct 3 ms 692 KB Output is correct
6 Correct 3 ms 600 KB Output is correct
7 Correct 5 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 696 KB Output is correct
2 Correct 3 ms 436 KB Output is correct
3 Correct 4 ms 688 KB Output is correct
4 Correct 3 ms 692 KB Output is correct
5 Correct 4 ms 688 KB Output is correct
6 Correct 4 ms 432 KB Output is correct
7 Correct 6 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 692 KB Output is correct
2 Correct 3 ms 436 KB Output is correct
3 Correct 3 ms 692 KB Output is correct
4 Correct 2 ms 688 KB Output is correct
5 Correct 5 ms 684 KB Output is correct
6 Correct 6 ms 692 KB Output is correct
7 Correct 5 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 688 KB Output is correct
2 Correct 4 ms 692 KB Output is correct
3 Correct 5 ms 436 KB Output is correct
4 Correct 4 ms 440 KB Output is correct
5 Correct 5 ms 440 KB Output is correct
6 Correct 4 ms 848 KB Output is correct
7 Correct 2 ms 688 KB Output is correct