Submission #525349

#TimeUsernameProblemLanguageResultExecution timeMemory
525349safaricolaXylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include "xylophone.h" static int ans[5010],diff1[5010],diff2[5010],mi,ma,miid,maid; bool greater[5010]; void solve(int N) { for(int i=1; i<N; i++){ diff1[i]=query(i,i+1); if(i!=N-1){ diff2[i]=query(i,i+2); } } ans[1]=1; //greater=1, i<i+1; for(int i=1; i<N; i++){ if(greate[i]){ ans[i+1]=ans[i]+diff1[i]; if(ans[i+1]>ma){ ma=ans[i+1]; maid=i+1; } } else{ ans[i+1]=ans[i]-diff1[i]; if(ans[i+1]<mi){ mi=ans[i+1]; miid=i+1; } } if(diff1[i+1]+diff1[i]==diff2[i]){ greate[i+1]=greate[i]; }else{ greate[i+1]=!greate[i]; } } if(mi<1){ for(int i=1; i<=N; i++){ ans[i]+=1-mi; } } if(miid>maid){ for(int i=1; i<=N; i++){ ans[i]=N+1-ans[i]; } } for(int i = 1; i <= N; i++) { answer(i, ans[i]); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:14:6: error: 'greate' was not declared in this scope; did you mean 'greater'?
   14 |   if(greate[i]){
      |      ^~~~~~
      |      greater
xylophone.cpp:29:4: error: 'greate' was not declared in this scope; did you mean 'greater'?
   29 |    greate[i+1]=greate[i];
      |    ^~~~~~
      |    greater
xylophone.cpp:31:4: error: 'greate' was not declared in this scope; did you mean 'greater'?
   31 |    greate[i+1]=!greate[i];
      |    ^~~~~~
      |    greater