제출 #13818

#제출 시각아이디문제언어결과실행 시간메모리
13818gs14004로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include <cstdio> #include <algorithm> #include <utility> #include <queue> using namespace std; typedef pair<int,int> pi; int n,p,q; pi a[1000005]; int b[50005], c[50005]; int t[1000005]; bool trial(int x){ priority_queue<int> pq; int bp = 0; int cnt = 0; for (int i=0; i<n; i++) { while(bp < p && b[bp] <= a[i].first){ int p = x; while (p && !pq.empty()) { pq.pop(); p--; cnt++; } bp++; } pq.push(a[i].second); } int sz = (int)pq.size(); for (int i=sz-1; i>=0; i--) { t[i] = pq.top(); pq.pop(); } bp = 0; int cp = 0; for (int i=0; i<sz; i++) { while (bp < q && c[bp] <= t[i]) { int p = x; while (p && cp < i) { cp++; cnt++; } } } return cnt == n; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){ p = A, q = B, n = T; for (int i=0; i<n; i++) { a[i] = pi(W[i],S[i]); } for (int i=0; i<p; i++) { b[i] = X[i]; } for (int i=0; i<q; i++) { c[i] = Y[i]; } sort(a,a+n); sort(b,b+p); sort(c,c+q); if(!trial(T)) return -1; int s = 0, e = T; while (s != e) { int m = (s+e)/2; if(trial(m)) e = m; else s = m+1; } return s; }

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

/tmp/cc3fc62L.o: In function `main':
grader.c:(.text.startup+0x176): undefined reference to `putaway'
collect2: error: ld returned 1 exit status