Submission #629629

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6296292022-08-14 19:28:56studyRarest Insects (IOI22_insects)C++17
100 / 100
60 ms412 KiB
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
int min_cardinality(int N) {
bitset<2000> inside;
int nbElems = 0;
for (int i=0; i<N; ++i){
move_inside(i);
if (i != 0){
int maxFreq = press_button();
if (maxFreq > 1) move_outside(i);
else{
++nbElems;
inside[i] = true;
}
}
else{
++nbElems;
inside[i] = true;
}
}
if (nbElems == 1) return N;
if (nbElems == N) return 1;
int in = nbElems, crt = 1;
int deb = 2, fin = N/nbElems, ans = 1;
vector<int> last;
while (deb <= fin){
int mid = fin-(fin-deb)/2;
if (crt > mid) mid = deb+(fin-deb)/2;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:43:9: warning: unused variable 'sqrt_siz' [-Wunused-variable]
   43 |     int sqrt_siz = sqrt((int)last.size());
      |         ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...