제출 #476412

#제출 시각아이디문제언어결과실행 시간메모리
476412IwanttobreakfreeXylophone (JOI18_xylophone)C++98
0 / 100
0 ms200 KiB
#include "xylophone.h"

static int A[5000];

void solve(int N) {
    int maxi=0,sol,ans;
    for(int i=2;i<=N;i++){
        int val=query(1,i);
        if(val>maxi){
            maxi=val;
            sol=i;
        }
    }
    maxi=0;
    for(int i=sol+1;i<=N;i++){
        int val=query(sol,i);
        if(val>maxi){
            maxi=val;
            ans=i;
        }
    }
    for(int i=sol-1;i>=1;i--){
        int val=query(i,sol);
        if(val>maxi){
            maxi=val;
            ans=i;
        }
    }
    answer(sol,ans);
}

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

xylophone.cpp:3:12: warning: 'A' defined but not used [-Wunused-variable]
    3 | static int A[5000];
      |            ^
xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:29:11: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     answer(sol,ans);
      |     ~~~~~~^~~~~~~~~
xylophone.cpp:29:11: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...