Submission #1129419

#TimeUsernameProblemLanguageResultExecution timeMemory
1129419svorogazeDetecting Molecules (IOI16_molecules)C++20
Compilation error
0 ms0 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define int long long vector<int> find_subset(int l, int r, vector<int> ve) { vector<pair<int, int>> w; for (int i = 0; i < ve.size(); ++i) { w.push_back({ve[i], i}); } sort(w.begin(), w.end()); for (int i = 0; i < w.size(); ++i) { if (w[i].first >= l && w[i].first <= r) return {w[i].second + 1}; } int kek = accumulate(ve.begin(), ve.end(), 0ll); if (kek >= l && kek <= r) { vector<int> rs(ve.size()); iota(rs.begin(), rs.end(), 1ll); return rs; } int sm = w[0].first;vector<int> ans; for (int i = 1; i < w.size(); ++i) { sm += w[i].first; if (sm >= l && sm <= r) { for (int j = 0; j <= i; ++j) { ans.push_back(w[j].second + 1); } return ans; } int xx = sm - w[0].first + w.back().first; if (xx >= l && xx <= r) { for (int j = 1; j <= i; ++j) { ans.push_back(w[j].second + 1); } ans.push_back(w.back().second + 1); } } return {}; }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/ccURxcBn.o: in function `main':
grader.cpp:(.text.startup+0x173): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status