Submission #248874

#TimeUsernameProblemLanguageResultExecution timeMemory
248874rocks03Detecting Molecules (IOI16_molecules)C++14
100 / 100
73 ms8696 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<ll,ll> #define ff first #define ss second #define pb push_back vector<int> find_subset(int l, int u, std::vector<int> w){ int N = w.size(); vector<pii> obj(N); for(int i = 0; i < N; i++) obj[i] = {w[i], i}; sort(obj.begin(), obj.end()); vector<ll> v(N+1, 0); for(int i = 1; i <= N; i++) v[i] = v[i-1] + obj[i-1].ff; vector<int> ans; for(int i = 1; i <= N; i++){ int p = upper_bound(v.begin(), v.end(), v[i-1]+u+1) - v.begin() - 1; if(p < 0 || v[p] - v[i-1] < l || v[p] - v[i-1] > u) continue; for(; i <= p; i++) ans.pb(obj[i-1].ss); return ans; } 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...