Submission #1020873

#TimeUsernameProblemLanguageResultExecution timeMemory
1020873mansurDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms432 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define rall(s) s.rbegin(), s.rend() #define all(s) s.begin(), s.end() #define sz(s) (int)s.size() #define s second #define f first using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; vector<int> find_subset(int l, int r, vector<int> w) { vector<pii> s; for (int i = 0; i < sz(w); i++) s.push_back({w[i], i}); sort(all(s)); ll sum = 0, is = 0; deque<int> res; for (int i = 0; i < sz(w) && !is; i++) { sum += s[i].f; res.push_back(i); if (sum > r) { sum -= s[res.front()].f; res.pop_front(); is = 1; } if (sum >= l) { vector<int> ans; for (int x: res) ans.push_back(s[x].s); return ans; } } return {}; }
#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...