Submission #305317

#TimeUsernameProblemLanguageResultExecution timeMemory
305317FdgStations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <algorithm> #include <memory.h> using namespace std; vector<pair<int, int>> dp; void upd(pair<int, int> &r, pair<int, int> a) { if (r.first == -1 || r.first < a.first || (r.first == a.first && r.second > a.second)) r = a; } int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); vector<pair<int, int>> v; for (int i = 0; i < n; ++i) v.push_back({b[i], a[i]}); sort(v.begin(), v.end()); dp.clear(); dp.resize(x + 1, {-1, -1}); dp[0] = {0, 0}; for (int t = 0; t < n; ++t) { for (int i = x; i >= 0; --i) { if (dp[i].first == -1) continue; // Take A. if (i + v[t].second <= x) { upd(dp[i + v[t].second], {dp[i].first + 1, dp[i].second}); } // Take B. if (dp[i].second + v[t].first <= y) { upd(dp[i], {dp[i].first + 1, dp[i].second + v[t].first}); } } } int ans = 0; for (int i = 0; i <= x; ++i) if (dp[i].first != -1 && dp[i].second <= y) ans = max(ans, dp[i].first); return ans; } int find_next_station(int s, int t, vector<int> st) { sort(st.begin(), st.end()); if (s < st[0]) { if (t < s) return st.back(); for (int x : st) if (t <= x) return x; return st.back(); } else { if (t > s) return st[0]; for (int i = st.size() - 1; i >= 0; --i) if (st[i] <= t) return st[i]; return st[0]; } }

Compilation message (stderr)

/tmp/ccu6OOEh.o: In function `main':
stub.cpp:(.text.startup+0x270): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status