Submission #916105

#TimeUsernameProblemLanguageResultExecution timeMemory
916105AiperiiiDetecting Molecules (IOI16_molecules)C++14
100 / 100
43 ms10032 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() #define ff first #define ss second #define pb push_back vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector <pair <ll,ll> > v; for(int i=0;i<n;i++){ v.pb({w[i],i}); } sort(all(v)); ll sum=0,p1=0; vector <int> ans; for(int i=0;i<n;i++){ sum+=v[i].ff; while(sum>u){ sum-=v[p1].ff; p1++; } if(sum>=l && sum<=u){ for(int j=p1;j<=i;j++)ans.pb(v[j].ss); break; } } 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...