Submission #925816

#TimeUsernameProblemLanguageResultExecution timeMemory
925816Art_ogoDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" #define int long long #define ve vector #define ll long long #define fi first #define se second using namespace std; vector<int> find_subset(int L, int u, vector<int> w) { int n = w.size(); ve<pair<int, int> > v(n); for(int i = 0; i < n; i++) v[i] = {w[i], i + 1}; sort(v.begin(), v.end()); ve<ll> p(n + 1, 0); for(int i = 1; i <= n; i++) p[i] = p[i - 1] + v[i - 1].fi; int l= 0, r = 0; while(l <= n && r <= n){ ll sum = p[r] - p[l]; if(sum >= L && sum < u){ ve<int> res; for(int i = l + 1; i <= r; i++) res.push_back(v[i].se); return res; } else if(sum < L) r++; else l++; } return {}; }

Compilation message (stderr)

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