Submission #1129420

#TimeUsernameProblemLanguageResultExecution timeMemory
1129420svorogazeDetecting Molecules (IOI16_molecules)C++20
0 / 100
1 ms328 KiB
//#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; 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}; } long long 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; } long long sm = w[0].first; vector<int> ans; for (int i = 1; i < w.size(); ++i) { if (sm > r) break; 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; } long long 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
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...