Submission #1179415

#TimeUsernameProblemLanguageResultExecution timeMemory
1179415MarwenElarbiKoala Game (APIO17_koala)C++17
Compilation error
0 ms0 KiB
int greaterValue(int N, int W) {
    int tab[100];
    memset(tab,0,sizeof tab);
    int cur[100];
    int l=1;
    int r=min(N/2,14);
    while(r-l>1){
        int mid=(r+l)/2;
        tab[0]=mid;
        tab[1]=mid;
        playRound(tab,cur);
        if(cur[0]<=mid&&cur[1]<=mid) l=mid;
        else if(cur[0]>mid&&cur[1]>mid) r=mid;
        else{
            return (cur[0]>cur[1] ? 0 : 1);
        }
    }
}

Compilation message (stderr)

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:3:5: error: 'memset' was not declared in this scope
    3 |     memset(tab,0,sizeof tab);
      |     ^~~~~~
koala.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | int greaterValue(int N, int W) {
koala.cpp:6:11: error: 'min' was not declared in this scope
    6 |     int r=min(N/2,14);
      |           ^~~
koala.cpp:11:9: error: 'playRound' was not declared in this scope
   11 |         playRound(tab,cur);
      |         ^~~~~~~~~
koala.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^