Submission #1232193

#TimeUsernameProblemLanguageResultExecution timeMemory
1232193inesfi드문 곤충 (IOI22_insects)C++20
25 / 100
99 ms428 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; // void move_inside(int i) // void move_outside(int i) // int press_button() const int TAILLEMAXI=2002; bool trouve[TAILLEMAXI]; int cb[TAILLEMAXI]; vector<int> diff; int min_cardinality(int N) { trouve[0]=true; move_inside(0); int nbdiff=1; cb[0]=1; diff.push_back(0); for (int i=1;i<N;i++){ move_inside(i); int nouv=press_button(); if (nouv==1){ nbdiff++; trouve[i]=1; cb[i]=1; diff.push_back(i); } else { move_outside(i); } } for (auto i:diff){ move_outside(i); } if (nbdiff<40){ for (int i=0;i<N;i++){ if (trouve[i]==false){ move_inside(i); int indice=0; bool ok=false; while (ok==false){ move_inside(diff[indice]); if (press_button()!=1){ cb[diff[indice]]++; ok=true; } move_outside(diff[indice]); indice++; } move_outside(i); trouve[i]=true; } } int rep=1000*1000; for (auto i:diff){ rep=min(rep,cb[i]); } return rep; } int nbtours=1; while (1>0){ int nouv=0; diff.clear(); for (int i=0;i<N;i++){ if (trouve[i]==false){ move_inside(i); if (press_button()==1){ nouv++; trouve[i]=true; diff.push_back(i); } else { move_outside(i); } } } if (nouv!=nbdiff){ return nbtours; } nbtours++; for (auto i:diff){ move_outside(i); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...