Submission #883355

#TimeUsernameProblemLanguageResultExecution timeMemory
883355marcidDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" #define int long long #define ii pair<int,int> #define iii tuple<int,int,int> #define vb vector<bool> #define vi vector<int> #define vii vector<ii> #define viii vector<iii> #define pb push_back #define eb emplace_back #define all(v) v.begin(),v.end() using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); std::vector< std::pair<int,int> > a(n); for (int i = 0; i < n; i++) { a[i]={w[i],i}; } sort(a.begin(),a.end()); int left = 0, right = 0; int curr = 0; while (right < n) { curr+=a[right].first; if (curr >= l) { while (curr > u && left < n) { curr-=a[left].first; left++; } if (l <= curr && curr <= u) { vi ret; for (int i = left; i <= right; i++) { ret.eb(a[i].second); } return ret; } else { right++; } } else { right++; } } return {}; }

Compilation message (stderr)

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