Submission #468409

#TimeUsernameProblemLanguageResultExecution timeMemory
468409pluto_ishDetecting Molecules (IOI16_molecules)C++14
69 / 100
56 ms5812 KiB
#include <bits/stdc++.h> #define pb push_back #define ff first #define ss second using namespace std; typedef long long ll; typedef unsigned long long ull; const ll INF = (ll)1<<62; const ll MOD = 1e9+7; const int iINF = 1<<30; const double PI = 3.14159265359; vector<int> find_subset(int l, int u, vector<int> w){ vector<pair<int, int> > wd; for(int i=0;i<(int)w.size();i++) wd.pb({w[i], i}); sort(wd.begin(), wd.end()); deque<int> ans; int i = 0, s = 0; while(i<(int)w.size()){ s += wd[i].ff; ans.pb(wd[i].ss); while(s > u){ s -= w[ans.front()]; ans.pop_front(); } i++; if(s >= l && s <= u){ vector<int> ret; for(int v : ans) ret.pb(v); return ret; } } 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...