제출 #1179433

#제출 시각아이디문제언어결과실행 시간메모리
1179433MarwenElarbi코알라 (APIO17_koala)C++17
컴파일 에러
0 ms0 KiB
bool cmp(int N,int i,int j){
    int tab[N];
    memset(tab,0,sizeof tab);
    int cur[N];
    int l=1;
    int r=min(N/2+1,9);
    while(r-l>1){
        int mid=(r+l)/2;
        tab[i]=mid;
        tab[j]=mid;
        playRound(tab,cur);
        if(cur[i]<=mid&&cur[j]<=mid) r=mid;
        else l=mid;
        if(cur[i]<=mid&&cur[j]>mid) return 0;
        if(cur[j]<=mid&&cur[i]>mid) return 1;
    }
    tab[i]=l;
    tab[j]=l;
    playRound(tab,cur);
    if(cur[i]<=l&&cur[j]>l) return 0;
    if(cur[j]<=l&&cur[i]>l) return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

koala.cpp: In function 'bool cmp(int, 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 | bool cmp(int N,int i,int j){
koala.cpp:6:11: error: 'min' was not declared in this scope
    6 |     int r=min(N/2+1,9);
      |           ^~~
koala.cpp:11:9: error: 'playRound' was not declared in this scope
   11 |         playRound(tab,cur);
      |         ^~~~~~~~~
koala.cpp:19:5: error: 'playRound' was not declared in this scope
   19 |     playRound(tab,cur);
      |     ^~~~~~~~~
koala.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^