Submission #796212

#TimeUsernameProblemLanguageResultExecution timeMemory
796212ln_eRarest Insects (IOI22_insects)C++17
0 / 100
189 ms584 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho #include "insects.h" using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=1000000007; ld const PI=3.14159265359; ll const MAX_N=3e5+5; ld const EPS=0.00000001; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define sz(a) (int)a.size() #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; int min_cardinality(int N) { vector<ll>v; for(ll i=0;i<N;i++) { v.pb(i); move_inside(i); } ll last=0; while(1!=0){ int x=press_button(); if(x==v.size()){ //out<<v.size()<<endl; return x; }else { vector<int>remove; while(press_button()==x&&v.size()>=1){ //cout<<v.back()<<endl; move_outside(v.back()); remove.pb(v.back()); v.pop_back(); } ll val=remove.back(); for(ll i=0;i<remove.size()-1;i++) { v.pb(remove[i]); move_inside(v[i]); } for(ll i=0;i<v.size();i++) { move_outside(v[i]); } for(ll i=0;i<remove.size()-1;i++) { v.pb(remove[i]); } move_inside(val); map<ll,ll>viz; for(ll i=0;i<v.size();i++){ move_inside(v[i]); ll val=press_button(); if(val==2){ viz[v[i]]=1; } move_outside(v[i]); } move_outside(val); vector<ll>nw; for(ll i=0;i<v.size();i++) { if(viz[v[i]]==0){ nw.pb(v[i]); move_inside(v[i]); } } v=nw; } } }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:31:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(x==v.size()){
      |            ~^~~~~~~~~~
insects.cpp:43:24: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |            for(ll i=0;i<remove.size()-1;i++)
      |                       ~^~~~~~~~~~~~~~~~
insects.cpp:48:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |           for(ll i=0;i<v.size();i++)
      |                      ~^~~~~~~~~
insects.cpp:52:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |             for(ll i=0;i<remove.size()-1;i++)
      |                        ~^~~~~~~~~~~~~~~~
insects.cpp:58:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |           for(ll i=0;i<v.size();i++){
      |                      ~^~~~~~~~~
insects.cpp:68:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |           for(ll i=0;i<v.size();i++)
      |                      ~^~~~~~~~~
insects.cpp:28:10: warning: unused variable 'last' [-Wunused-variable]
   28 |       ll last=0;
      |          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...