Submission #661339

#TimeUsernameProblemLanguageResultExecution timeMemory
661339GoldLightDetecting Molecules (IOI16_molecules)C++17
100 / 100
47 ms6208 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> w){ vector<pair<int,int>> v; int n=w.size(); for(int i=0; i<n; i++){ v.push_back({w[i], i}); } sort(v.begin(), v.end()); long long sum=0; vector<int> ans; int pos=0; for(int i=0; i<n; i++){ sum+=v[i].first; while(sum>r){ sum-=v[pos].first; pos++; } if(sum>=l){ for(int j=pos; j<=i; j++) ans.push_back(v[j].second); 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...