제출 #867408

#제출 시각아이디문제언어결과실행 시간메모리
867408cheat_when_I_was_youngDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms348 KiB
#include "molecules.h" #include "bits/stdc++.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int,int>> a; for (int i = 0; i < (int)w.size(); ++i) a.push_back({w[i], i}); sort(a.begin(), a.end()); queue<int> q; vector<int> ans; long long s = 0; for (int i = 0; i < (int)a.size(); ++i) { q.push(a[i].second); s += a[i].first; if (l <= s && s <= u) break; while (!q.empty() && s > u) { s -= w[q.front()]; q.pop(); } } if (s < l || s > u) return vector<int>(0); while (!q.empty()) { ans.push_back(q.front() + 1); q.pop(); } return ans; }
#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...