Submission #1078392

#TimeUsernameProblemLanguageResultExecution timeMemory
1078392sqrteipiDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ int n, l, r; cin >> n >> l >> r; vector<pair<int, int>> vec; for (int i=0; i<n; i++) { int k; cin >> k; vec.push_back({k, i}); } sort(vec.begin(), vec.end()); int mi = 0, ma = 0, li = 0, ri = n - 1; while (li < n) { mi += vec[li].first, ma += vec[ri].first; if (l <= mi && mi <= r) { cout << li + 1 << "\n"; for (int i=0; i<=li; i++) cout << vec[i].second << " "; return 0; } if (l <= ma && ma <= r) { cout << li + 1 << "\n"; for (int i=ri; i<n; i++) cout << vec[i].second << " "; return 0; } if (mi <= l && r <= ma) { int sum = mi - vec[li].first; for (int i=li; i<n; i++) { sum += vec[i].first; if (l <= sum && sum <= r) { cout << li + 1 << "\n"; for (int j=i-li; j<=i; j++) cout << vec[j].second << " "; return 0; } sum -= vec[i-li].first; } } li++, ri--; } cout << 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccP9sfNq.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccLtul6o.o:molecules.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccP9sfNq.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