Submission #714098

#TimeUsernameProblemLanguageResultExecution timeMemory
714098PherokungRarest Insects (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h" #include<bits/stdc++.h> using namespace std; int min_cardinality(int n) { int be = 1, ed = n, type = 0; stack<int> in; for(int i=0;i<n;i++){ move_inside(i); if(press_button() > 1) move_outside(i); else type++, in.push(i); } while(be <= ed){ int mid = (be+ed)/2, cnt = 0; while(!in.empty()){ move_outside(in.top()); in.pop(); } for(int i=0;i<n,cnt<mid*type;i++){ move_inside(i); if(press_button() > mid) move_outside(i); else cnt++, in.push(i); } if(cnt == mid * type) be = mid+1; else ed = mid-1; } return ed; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:18:18: warning: left operand of comma operator has no effect [-Wunused-value]
   18 |     for(int i=0;i<n,cnt<mid*type;i++){
      |                 ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...