Submission #831286

#TimeUsernameProblemLanguageResultExecution timeMemory
831286manhtuan22007Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define int long long #define ll long long using namespace std; vector<int> find_subset(int l , int u , vector<int> w){ int n = (int)w.size(); vector<pair<int , int>> a; for(int i = 0 ; i < n ; i ++){ a.push_back({w[i] , i}); } sort(a.begin() , a.end()); int sum = 0 , j = 0; for(int i = 0 ; i < n ; i ++){ sum += a[i].first; while(sum > u && j <= i){ sum -= a[j].first; ++j; } if(sum >= l){ vector<int> res; for(int x = j ; x <= i ; x ++) res.push_back(a[x].second); return res; } } return {}; } // int32_t main(){ // // vector<int> x = find_subset(10, 20, {15, 17, 16, 18}); // // for(int i : x) cout << i << " "; // }

Compilation message (stderr)

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