Submission #641885

#TimeUsernameProblemLanguageResultExecution timeMemory
641885ivazivaXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; #define MAXN 5010 long long a[MAXN],d1[MAXN],d2[MAXN],e[MAXN]; void solve(long long n) { for (long long i=0;i<n-1;i++) d1[i]=query(i+1,i+2); for (long long i=0;i<n-2;i++) d2[i]=query(i+1,i+3); e[0]=d1[0]; for (long long i=1;i<n-1;i++) { e[i]=d1[i]; if (e[i-1]<0) { e[i]=-e[i]; } if (d1[i-1]+d1[i]!=d2[i-1]) { e[i]=-e[i]; } } long long mn=0,mni=0,cur=0; for (long long i=1;i<n;i++) { cur+=e[i-1]; if (cur<e[i-1]) { mni=i; mn=cur; } } cur=0; for (long long i=mni;i<n;i++) { a[i]=cur; cur+=e[i-1]; } cur=0; for (long long i=mni;i>=0;i--) { cur-=e[i]; a[i]=cur; } long long pos=0; while (a[pos]!=n-1) pos++; if (mni>pos) { for (long long i=0;i<n;i++) a[i]=n-1-a[i]; } for (long long i=0;i<n;i++) answer(i+1,a[i]+1); }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(long long int)':
xylophone.cpp:32:15: warning: variable 'mn' set but not used [-Wunused-but-set-variable]
   32 |     long long mn=0,mni=0,cur=0;
      |               ^~
/usr/bin/ld: /tmp/ccn0I4yF.o: in function `main':
grader.cpp:(.text.startup+0x30): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status