제출 #897918

#제출 시각아이디문제언어결과실행 시간메모리
897918Jawad_Akbar_JJ로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <set> #include <cassert> #include <algorithm> using namespace std; const int N = 1001; multiset<int> part[N]; int resp[N]; int putaway(int a,int b,int t,int x[],int y[],int w[],int s[]){ vector<pair<int,int>> v; for (int i=0;i<t;i++) v.push_back({w[i],s[i]}); sort(begin(v),end(v)); sort(x,x + a); int ind = 0; for (int i=0;i<t;i++){ while (ind < a and v[i].first >= x[ind]) ind++; if (ind == a){ ind--; while (i<t){ part[1000].insert(v[i].second); i++; } break; } part[ind].insert(v[i].second); } sort(y,y + b); for (int i=0;i<=ind;i++) resp[i] = i; int erased = 0; int tm = 0; while (erased < t){ tm++; bool er = false; for (int i=0;i<b;i++){ for (int j=1000;j>=0;j--){ if (part[j].size()==0) continue; auto u = part[j].upper_bound(y[i]); if (u==begin(part[j])) continue; u = prev(u); erased++; er = true; // cout<<"round "<<tm<<" from part["<<j<<"] "<<y[i]<<" erased "<<*u<<endl; part[j].erase(u); break; } } for (int i=ind;i>=0;i--){ while (resp[i]>-1 and part[resp[i]].size()==0) resp[i]--; if (resp[i]==-1) continue; int k = resp[i]; part[k].erase(prev(end(part[k]))); er = true; erased++; // cout<<"round "<<tm<<" from part["<<k<<"] "<<x[i]<<" erased last"<<endl; } if (!er) return -1; // cout<< } return tm; }

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

/usr/bin/ld: /tmp/ccWOHWfz.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status