제출 #860782

#제출 시각아이디문제언어결과실행 시간메모리
860782vjudge1죄수들의 도전 (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; set<int> S; int ask(int y){ cout<<"? "<<y<<endl; cout.flush(); int x; cin>>x; if(x==-1) return -1; S.insert(x^y); return x^y; } int tree(int pot, int m, int minimo, int maximo){ if((maximo==minimo)|(pot==1)){ return 0; }else if(maximo<m+(pot/2)){ return tree(pot/2, m, minimo, maximo); }else if(minimo>=m+(pot/2)){ return tree(pot/2, pot/2+m, minimo, maximo); }else{ int M = ask(m+pot/2-1); if(M==-1) return -1; int s=0; if((M!=minimo)&(M!=maximo)){ s=tree(pot/2, m, minimo, M); } if(s==-1) return -1; M = ask(m+pot/2); if(M==-1) return -1; s=0; if((M!=minimo)&(M!=maximo)){ s=tree(pot/2, m+pot/2, M, maximo); } if(s==-1) return -1; } return 0; } int main(){ int T=1; for(int dalekofrivia=T; dalekofrivia>0; dalekofrivia--){ int n; cin>>n; int pot=1; while(pot<1000000000){ pot*=2; } int l = ask(0); int r = ask(pot-1); if(tree(pot, 0, l, r)==0){ cout<<"!"; for(int x: S) cout<<" "<<x; cout<<endl; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccdJ5SJ3.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cctLtut5.o:prison.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccdJ5SJ3.o: in function `main':
grader.cpp:(.text.startup+0x194): undefined reference to `devise_strategy(int)'
collect2: error: ld returned 1 exit status