Submission #796186

#TimeUsernameProblemLanguageResultExecution timeMemory
796186ln_eRarest Insects (IOI22_insects)C++17
0 / 100
1 ms208 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); } while(1!=0){ int x=press_button(); if(x==1){ return 1; } if(x==v.size()){ 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(); } for(ll i=0;i<remove.size()-1;i++) { v.pb(remove[i]); } } } }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:33:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     if(x==v.size()){
      |        ~^~~~~~~~~~
insects.cpp:43:21: 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++)
      |                    ~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...