Submission #476412

#TimeUsernameProblemLanguageResultExecution timeMemory
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); }

Compilation message (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...