제출 #651338

#제출 시각아이디문제언어결과실행 시간메모리
651338ayallaDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define int long long int #define endl '\n' #define pb push_back #define pi pair<int, int> #define pii pair<int, pi> #define fir first #define sec second #define MAXN 500001 #define mod 1000000007 vector<int> find_subset(int l, int r, vector<int> w) { int n = w.size(); set<pi> s; int sum = 0; for (int i = 0; i < n; i++) { s.insert({w[i], i}); sum += w[i]; } vector<bool> vis(n, 1); while (sum > r) { int dif = sum - r; auto it = s.lower_bound({dif, -1}); if (it != s.end() && (sum - (*it).fir) >= l && (sum - (*it).fir) <= r) { pi x = *it; sum -= x.fir; vis[x.sec] = 0; break; } else { pi x = *s.begin(); sum -= x.fir; vis[x.sec] = 0; s.erase(x); } } if (sum < l) return {}; vector<int> ans; for (int i = 0; i < n; i++) { if (vis[i]) ans.pb(i); } return ans; } // r + min >= max + l // r - max >= l - min

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

/usr/bin/ld: /tmp/cczxviqh.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