제출 #501543

#제출 시각아이디문제언어결과실행 시간메모리
501543kevin로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; #define ll long long #define nl cout<<"\n" #define s second #define f first #define all(x) x.begin(), x.end() #define ca(v) for(auto i:v) cout<<i<<" "; bool solve(int m, vector<int> &X, vector<int> &Y, vector<pair<int, int>> &T){ set<pair<int, int>> st; for(int i:X) st.insert({i, m}); vector<pair<int, int>> P1; vector<pair<int, int>> P2; for(auto p:T) P1.push_back(p); sort(all(P1)); while(P1.size()){ auto c = P1.back(); P1.pop_back(); auto it = st.upper_bound({c.s, m+1}); if(it != st.end()){ auto nxt = *it; st.erase(it); nxt.s--; if(nxt.s) st.insert(nxt); } else{ P2.push_back({c.s, c.f}); } } sort(all(P2)); st.clear(); for(int i:Y) st.insert({i, m}); while(P2.size()){ auto c = P2.back(); P2.pop_back(); auto it = st.upper_bound({c.s, m+1}); if(it != st.end()){ auto nxt = *it; st.erase(it); nxt.s--; if(nxt.s) st.insert(nxt); } else{ return false; } } return true; } int putaway(int A, int B, int N, vector<int> X, vector<int> Y, vector<int> W, vector<int> S){ sort(all(X)); sort(all(Y)); int ans = N+1; int l = 1; int r = N; vector<pair<int, int>> T; for(int i=0; i<N; i++) T.push_back({S[i], W[i]}); while(l <= r){ int m = (l + r) / 2; if(solve(m, X, Y, T)){ ans = m; r = m-1; } else l = m+1; } if(ans == N+1) return -1; return ans; }

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

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