제출 #796209

#제출 시각아이디문제언어결과실행 시간메모리
796209ln_e드문 곤충 (IOI22_insects)C++17
0 / 100
320 ms416 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<v.size();i++) { move_outside(v[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; for(ll i=0;i<remove.size()-1;i++) { v.pb(remove[i]); move_inside(v[i]); } } } }

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:31:9: 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:19: 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]
   43 |       for(ll i=0;i<v.size();i++)
      |                  ~^~~~~~~~~
insects.cpp:49:19: 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]
   49 |       for(ll i=0;i<v.size();i++){
      |                  ~^~~~~~~~~
insects.cpp:59:19: 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]
   59 |       for(ll i=0;i<v.size();i++)
      |                  ~^~~~~~~~~
insects.cpp:67: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]
   67 |         for(ll i=0;i<remove.size()-1;i++)
      |                    ~^~~~~~~~~~~~~~~~
insects.cpp:28:6: 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...