제출 #51014

#제출 시각아이디문제언어결과실행 시간메모리
51014FLDutchman커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.cpp" //#include "prize.h" using namespace std; #define mp make_pair #define pb push_back const int INF = 1000000000; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long double num; typedef pair<num, num> nn; typedef vector<nn> vnn; typedef vector<num> vn; typedef vector<vn> vvn; vii answers; int maxVal = 0; int N; ii query(int i){ if(answers[i] != mp(-1, -1)) return answers[i]; vi a = ask(i); return answers[i] = mp(a[0], a[1]); } void genQueries(){ // do 711 queries in the shape of a bs queue<ii> bounds; bounds.push(mp(-1, N)); int queriesLeft = 711; while(queriesLeft --){ ii q = bounds.front(); bounds.pop(); int mb = (q.first+q.second)/2; query(mb); maxVal = max(maxVal, answers[mb].first + answers[mb].second); bounds.push(mp(q.first, mb)); bounds.push(mp(mb, q.second)); } } int find_best(int n){ N = n; int betterFound = 0; int lb = -1; while(betterFound < maxVal){ int rb = n; while(lb + 1 != rb){ int mb = (lb + rb)/2; ii ans = query(mb); if(ans.second < maxVal - betterFound){ rb = mb; } else { lb = mb; } } betterFound++; lb++; } for(int i = 0; i < answers.size(); i++){ if(answers[i] == mp(0, 0)) return i; } }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < answers.size(); i++){
                    ~~^~~~~~~~~~~~~~~~
prize.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/cchOhfG2.o: In function `ask(int)':
grader.cpp:(.text+0x0): multiple definition of `ask(int)'
/tmp/cc84Urji.o:prize.cpp:(.text+0x0): first defined here
/tmp/cchOhfG2.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc84Urji.o:prize.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status