Submission #709564

#TimeUsernameProblemLanguageResultExecution timeMemory
709564ToroTNXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include "xylophone.h" #include "grader.cpp" //static int A[5000]; int n,dis[5005][2],arr[5005],flip[5005],mn,mx,idx_mn,idx_mx; void solve(int N) { n=N; for(int i=1;i<=n;i++) { if(i+1<=n)dis[i][0]=query(i,i+1); if(i+2<=n)dis[i][1]=query(i,i+2); } /*for(int i=1;i<n;i++)printf("%d ",dis[i][0]); printf("\n"); for(int i=1;i<n-1;i++)printf("%d ",dis[i][1]); printf("\n");*/ arr[1]=0; arr[2]=dis[1][0]; for(int i=2;i<n;i++) { if(dis[i-1][1]==dis[i-1][0]+dis[i][0]) { if(arr[i]>arr[i-1]) { arr[i+1]=arr[i]+dis[i][0]; }else { arr[i+1]=arr[i]-dis[i][0]; } }else if(dis[i-1][0]==dis[i-1][1]) { if(arr[i]>arr[i-1]) { arr[i+1]=arr[i]-dis[i][0]; }else { arr[i+1]=arr[i]+dis[i][0]; } }else { if(arr[i]>arr[i-1]) { arr[i+1]=arr[i]-dis[i][0]; }else { arr[i+1]=arr[i]+dis[i][0]; } } } for(int i=1;i<=n;i++)flip[i]=-arr[i]; mn=1e9; mx=-1e9; for(int i=1;i<=n;i++) { if(arr[i]>mx) { mx=arr[i],idx_mx=i; } if(arr[i]<mn) { mn=arr[i],idx_mn=i; } } if(idx_mn<idx_mx) { for(int i=1;i<=n;i++) { answer(i,arr[i]+1-mn); } }else { mn=1e9; mx=-1e9; for(int i=1;i<=n;i++) { if(flip[i]>mx) { mx=flip[i],idx_mx=i; } if(flip[i]<mn) { mn=flip[i],idx_mn=i; } } for(int i=1;i<=n;i++) { answer(i,flip[i]+1-mn); } } }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc3shFiv.o: in function `query(int, int)':
grader.cpp:(.text+0x0): multiple definition of `query(int, int)'; /tmp/ccBd2NSv.o:xylophone.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cc3shFiv.o: in function `answer(int, int)':
grader.cpp:(.text+0xa0): multiple definition of `answer(int, int)'; /tmp/ccBd2NSv.o:xylophone.cpp:(.text+0xa0): first defined here
/usr/bin/ld: /tmp/cc3shFiv.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBd2NSv.o:xylophone.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status