제출 #1000365

#제출 시각아이디문제언어결과실행 시간메모리
1000365GrayDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <algorithm> #include <cassert> #include <cmath> #include <iomanip> #include <iostream> #include <stack> #include <vector> #define ll long long #define ld double #define ff first #define ss second #define ln "\n" using namespace std; const ll MOD = (ll)1e9+7; const ll INF = 2e18; vector<int> find_subset(int d, int u, vector<int> &w){ ll n = w.size(); vector<pair<ll, ll>> iw(n); for (ll i=0; i<n; i++) iw[i] = {w[i], i}; sort(iw.begin(), iw.end()); ll l=0, r=0; ll sum=iw[0].ff; while (r<n){ if (sum<=u){ if (sum>=d){ vector<int> ans; ll rsum=0; for (ll i=l; i<=r; i++){ rsum+=iw[i].ff; ans.push_back(iw[i].ss); } assert(rsum<=u and rsum>=d); return ans; }else{ r++; sum+=iw[r].ff; } }else{ sum-=iw[l].ff; l++; } } return {}; }

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

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