제출 #685710

#제출 시각아이디문제언어결과실행 시간메모리
685710BliznetcDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz size() #define all(x) x.begin(), x.end() #define F first #define S second #define int long long typedef pair < int, int > pii; typedef vector < int > vi; typedef vector < vi > vvi; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); pair<int,int> a[n + 7]; int sum = 0; for (int i = 1; i <= n; i++) { a[i] = {w[i - 1], i}; sum += a[i].F; } sort (a + 1, a + n + 1); if (sum < l) { return vector<int> (0); } int r = u; if (a[1].F > u) { return vector<int>(0); } int cur = 0; vector<int> result; for (int i = 1; i <= n; i++) { if (cur + a[i].F >= l) { if (cur + a[i].F <= r) { cur += a[i].F; result.pb(a[i].S); } break; } cur += a[i].F; result.pb(a[i].S); } if (cur < l) { for (int i = 0; i < (int)result.size(); i++) { if (cur - a[i + 1].F + a[n].F <= r) { result[i] = a[n].S; break; } } } if (cur >= l && cur <= r) { return result; } return vector<int> (0); }

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

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