제출 #278795

#제출 시각아이디문제언어결과실행 시간메모리
278795ScarletS로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size() using namespace std; bool ok(int k, vector<pair<int,int>> v, int X[], int Y[], int A, int B, int T) { //cout<<"k = "<<k<<"\n"; int cur=0; priority_queue<pair<int,int>> q; for (int i=0;i<A;++i) { //cout<<"currently on "<<X[i]<<"\n"; while (cur<T) { if (v[cur].first>=X[i]) break; q.push({v[cur].second,v[cur].first}); ++cur; } for (int j=0;j<k&&sz(q);++j) { //cout<<q.top().first<<" "<<q.top().second<<"\n"; q.pop(); } } //cout<<sz(q)<<"!\n"; while (cur<T) { q.push({v[cur].second,v[cur].first}); ++cur; } //cout<<sz(q)<<"!\n"; for (int i=0;i<B;++i) { for (int j=0;j<k&&sz(q);++j) { if (q.top().first>=Y[i]) { //cout<<"oopsie\n"; //cout<<q.top().first<<" "<<Y[i]<<"\n"; return 0; } q.pop(); } } if (sz(q)) return 0; return 1; } int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]) { int l=1,r=T,m; vector<pair<int,int>> v; for (int i=0;i<T;++i) v.push_back({W[i],S[i]}); sort(v.begin(), v.end()); sort(X,X+A); sort(Y,Y+B,greater<int>()); if (!ok(T,v,X,Y,A,B,T)) return -1; while (l<r) { m=l+(r-l)/2; if (ok(m,v,X,Y,A,B,T)) r=m; else l=m+1; } return l; } /**int main() { ios_base::sync_with_stdio(0); cin.tie(0); int A,B,T; cin>>A>>B>>T; int X[A],Y[B],W[T],S[T]; for (int i=0;i<A;++i) cin>>X[i]; for (int i=0;i<B;++i) cin>>Y[i]; for (int i=0;i<T;++i) cin>>W[i]>>S[i]; cout<<putaway(A,B,T,X,Y,W,S); return 0; }**/

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

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