Submission #717746

#TimeUsernameProblemLanguageResultExecution timeMemory
717746ToxtaqDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#include "molecules.h" /// https://codeforces.com/blog/entry/52464 /// https://oj.uz/submission/715687 using namespace std; vector<int> find_subset(int l, int r, vector<int>w){ int n = w.size(); vector<pair<int, int>>sorted(n); for(int i = 0;i < n;++i){ sorted[i] = {w[i], i}; } sort(sorted.begin(), sorted.end()); vector<int>ans; int left = 0, right = 0; long long sum = 0; while(left <= right && right < n){ sum += sorted[right].first; while(sum > r){ sum -= sorted[left].first; left++; } if(sum >= l && sum <= r){ for(int i = left;i <= right;++i){ ans.push_back(sorted[i].second); } return ans; } right++; } return ans; } int main() { int l, r, n; cin >> l >> r >> n; vector<int>v(n); for(int i = 0;i < n;++i)cin >> v[i]; vector<int>ans = find_subset(l, r, v); for(int i : ans)cout << i << " "; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccyKSH2N.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccJZCs3Q.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status