제출 #1020710

#제출 시각아이디문제언어결과실행 시간메모리
1020710mansurDetecting Molecules (IOI16_molecules)C++17
19 / 100
1 ms600 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; deque<int> res; for (int i = 0; i < sz(w); i++) { sum += s[i].f; res.push_back(i); if (sum > r) { sum -= w[res.front()]; res.pop_front(); } 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...