제출 #759838

#제출 시각아이디문제언어결과실행 시간메모리
759838JellyTheOctopusDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
// IOI 2016 Day 1 Problem 1 // Detecting Molecules // https://oj.uz/problem/view/IOI16_molecules #include <bits/stdc++.h> using namespace std; #define f first #define s second vector<int> find_subset(long long l, long long u, vector<int> w) { int N = (int)w.size(); vector<pair<long long, int>> valWeight(N); for (int i = 0; i < N; i++) { valWeight[i] = {w[i]*1LL, i}; } sort(valWeight.begin(), valWeight.end()); deque<int> dq; long long curSum = 0; int i = 0; while (i < N) { if (l <= curSum && curSum <= u) { break; } if (curSum > u) { curSum -= valWeight[dq.front()].f; dq.pop_front(); continue; } if (curSum < l) { curSum += valWeight[i].f; dq.push_back(i); i++; } } vector<int> ans; while (!dq.empty() && (l <= curSum && curSum <= u)) { ans.push_back(valWeight[dq.front()].s); dq.pop_front(); } sort(ans.begin(), ans.end()); return ans; }

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

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