Submission #701581

#TimeUsernameProblemLanguageResultExecution timeMemory
701581Alexabcde1Xylophone (JOI18_xylophone)C++98
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define f first #define s second using namespace std; long long n,i,j,ress[5005][5005],resp,neg,minn,maxx; long long ans[5005]; long long res(long long x,long long y){ if (ress[x][y]!=0) return ress[x][y]; cout<<"Q "<<x<<" "<<y<<endl; cin>>ress[x][y]; return ress[x][y]; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; if (n==2){ cout<<"A 1 2"<<endl; return 0; } ans[1]=0; for (i=1;i<=n-2;i++){ if (res(i,i+1)+res(i+1,i+2)==res(i,i+2)){ ans[i+1]=ans[i]+res(i,i+1); ans[i+2]=ans[i]+res(i,i+2); if (ans[i+2]>=n){ ans[i+1]=ans[i]-res(i,i+1); ans[i+2]=ans[i]-res(i,i+2); } } else { ans[i+1]=ans[i]+res(i,i+1); ans[i+2]=ans[i+1]-res(i+1,i+2); if (ans[i+1]>=n){ ans[i+1]=ans[i]-res(i,i+1); ans[i+2]=ans[i+1]+res(i+1,i+2); } } if (ans[i+2]<0 || ans[i+1]<0) neg=1; } maxx=1; minn=1; for (i=2;i<=n;i++){ if (ans[i]>ans[maxx]) maxx=i; if (ans[i]<ans[minn]) minn=i; } if (maxx<minn) { for (i=1;i<=n;i++){ ans[i]=-ans[i]; } } minn=ans[1]; for (i=2;i<=n;i++){ minn=min(minn,ans[i]); } minn=-minn+1; cout<<"A"; for (i=1;i<=n;i++) cout<<" "<<ans[i]+minn; cout<<endl; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cchbcPOE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccOcVusE.o:xylophone.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cchbcPOE.o: in function `main':
grader.cpp:(.text.startup+0x30): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status