제출 #936787

#제출 시각아이디문제언어결과실행 시간메모리
9367874QT0RDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long vector<ll> find_subset(ll l, ll u, vector<ll> w){ ll n=w.size(),sm=0; vector<ll> ans; vector<pair<ll,ll>> cp; for (int i = 0; i<n; i++){ sm+=w[i]; cp.push_back({w[i],i}); } sort(cp.begin(),cp.end()); if (sm<l)return {}; set<pair<ll,ll>> s; sm=0; for (int i = 0; i<n; i++){ sm+=cp[i].first; s.insert(cp[i]); if (l<=sm && sm<=u){ for (auto u : s)ans.push_back(u.second); break; } if (sm>u){ auto it = s.lower_bound({u-sm,-1}); if (it==s.end())it--; sm-=it->first; s.erase(it); } if (l<=sm && sm<=u){ for (auto u : s)ans.push_back(u.second); break; } } return ans; }

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

/usr/bin/ld: /tmp/ccC2fEjl.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status