Submission #728540

#TimeUsernameProblemLanguageResultExecution timeMemory
728540raul2008487Rarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include "insects.h" int min_cardinality(int N) { bool fl[N]; memset(fl,false,sizeof(fl)); int i,j,cur=0,ans=0,mini=N,query=0; for(i=0;i<N-1;i++){ if(fl[i]){ continue; } fl[i]=true; move_inside(i); cur=1; for(j=i+1;j<N;j++){ if(!fl[j]){ fl[]=true; move_inside(j); cur++; query=press_button(); if(query!=cur){ cur--; } move_outside(j); } } if(cur<mini){ mini=cur; ans=i; } if(mini==1){ return ans; } move_outside(i); } return ans; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:4:5: error: 'memset' was not declared in this scope
    4 |     memset(fl,false,sizeof(fl));
      |     ^~~~~~
insects.cpp:2:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    1 | #include "insects.h"
  +++ |+#include <cstring>
    2 | int min_cardinality(int N) {
insects.cpp:15:24: error: expected primary-expression before ']' token
   15 |                     fl[]=true;
      |                        ^