Submission #813581

#TimeUsernameProblemLanguageResultExecution timeMemory
813581Edu175Rarest Insects (IOI22_insects)C++17
0 / 100
321 ms208 KiB
#include "insects.h" #include <bits/stdc++.h> #define pb push_back #define fst first #define snd second #define fore(i,a,b) for(ll i=a,ioi=b;i<ioi;i++) #define SZ(x) ((int)x.size()) #define ALL(x) x.begin(),x.end() #define mset(a,v) memset((a),(v),sizeof(a)) #define imp(v) for(auto djfhg:v)cout<<djfhg<<" ";cout<<"\n" using namespace std; typedef long long ll; typedef pair<ll,ll> ii; //const ll MAXN=205; void in(ll i){ move_inside(i); } void out(ll i){ move_outside(i); } ll ask(){ return press_button(); } int min_cardinality(int N){ ll n=N; vector<ll>a; fore(i,0,n)a.pb(i),in(i); vector<ll>ban(n); ll mx; while(SZ(a)){ mx=ask(); fore(i,0,SZ(a)){ out(a[i]); if(ask()<mx)ban[a[i]]=1; in(a[i]); } vector<ll>ai; for(auto i:a){ if(!ban[i])ai.pb(i); else out(i); } a=ai; } return mx; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:46:9: warning: 'mx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   46 |  return mx;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...