제출 #209426

#제출 시각아이디문제언어결과실행 시간메모리
209426TAISA_커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; using P=pair<int,int>; vector<int> s; vector<int> ask(int id){ cout<<id<<endl; int a,b;cin>>a>>b; vector<int> res{a,b}; return res; } int find_best(int n) { vector<int> a; vector<P> v(n,P(-1,-1)); int en=n; int cnt=0; int ma=3; for(int i=0;i<min(n,500);i++){ a=ask(i); ma=max(ma,a[0]+a[1]); v[i]=P(a[0],a[1]); } while(1){ int ok=0,ng=en; while(ng-ok>1){ int mid=(ok+ng)/2; if(v[mid].first==-1){ a=ask(mid); v[mid]=P(a[0],a[1]); } if(v[mid].second==cnt){ if(v[mid].second+v[mid].first==ma){ ng=mid; }else{ ok=mid; } }else{ ok=mid; } } // cout<<ok<<endl; if(v[ok].first+v[ok].second==0){ return ok; } en=ok; cnt++; } return 0; } int main(){ int n;cin>>n; s.resize(n); for(int i=0;i<n;i++){ cin>>s[i]; } cout<<find_best(n)<<endl; }

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

/tmp/ccgK3fXu.o: In function `ask(int)':
grader.cpp:(.text+0x0): multiple definition of `ask(int)'
/tmp/ccaw09iY.o:prize.cpp:(.text+0x0): first defined here
/tmp/ccgK3fXu.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccaw09iY.o:prize.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status