Submission #257195

#TimeUsernameProblemLanguageResultExecution timeMemory
257195a_playerXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#ifndef A #include "xylophone.h" #endif #include <bits/stdc++.h> using namespace std; const int nax=5e3+3; int d[nax],t[nax]; int m[nax]; int p[nax],pp[nax]; int query(int a, int b){ cout<<a<<" "<<b<<endl; int h; cin>>h; return h; } void answer(int a, int b){ cout<<a<<": "<<b<<endl; } void solve(int N) { for(int i=0;i<N-1;i++)d[i]=query(i,i+1); for(int i=0;i<N-2;i++)t[i]=query(i,i+2); m[0]=d[0]; if(t[0]==d[0]+d[1])m[1]=d[1]; else m[1]=-d[1]; for(int i=1;i<N-2;i++){ int s=m[i]/abs(m[i]); if(t[i]==d[i]+d[i+1])m[i+1]=s*d[i+1]; else m[i+1]=-s*d[i+1]; } for(int i=1;i<N;i++)p[i]=p[i-1]+m[i-1]; int mini=*min_element(p,p+N); for(int i=0;i<N;i++)p[i]+=-mini+1; bool flag=false; bool uno=false; for(int i=0;i<N;i++){ if(p[i]==1)uno=true; if(p[i]>N)flag=true; if(p[i]==N&&!uno)flag=true; } if(!flag){ for(int i=0;i<N;i++)answer(i,p[i]); return; } for(int i=1;i<N;i++)p[i]=p[i-1]-m[i-1]; mini=*min_element(p,p+N); for(int i=0;i<N;i++)p[i]+=-mini+1; for(int i=0;i<N;i++)answer(i,p[i]); } int main(){ int N; cin>>N; solve(N); }

Compilation message (stderr)

/tmp/cc3tp1Yt.o: In function `query(int, int)':
grader.cpp:(.text+0x0): multiple definition of `query(int, int)'
/tmp/cccQupFB.o:xylophone.cpp:(.text+0x0): first defined here
/tmp/cc3tp1Yt.o: In function `answer(int, int)':
grader.cpp:(.text+0x90): multiple definition of `answer(int, int)'
/tmp/cccQupFB.o:xylophone.cpp:(.text+0xd0): first defined here
/tmp/cc3tp1Yt.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cccQupFB.o:xylophone.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status