제출 #491312

#제출 시각아이디문제언어결과실행 시간메모리
491312tempusDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms292 KiB
#include "molecules.h" #include <bits/stdc++.h> #define ll int using namespace std; std::vector<int> find_subset(int l, int u, std::vector<ll> w) { int n = w.size(); pair <ll, int> a[n]; for (int i = 0; i < n; ++ i) { if (l <= w[i] && w[i] <= u) { return vector <int>(1, i + 1); } a[i].first = w[i]; a[i].second = i; } sort(a, a + n); ll sum = 0; vector <int> ans; for (int i = n - 1; i >= 0; -- i) { if (a[i].first > u) continue; sum += a[i].first; ans.push_back(a[i].second); if (l <= sum && sum <= u) { sort(ans.begin(), ans.end()); return ans; } } return vector <ll> (0); }
#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...