제출 #409597

#제출 시각아이디문제언어결과실행 시간메모리
409597pliamDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms292 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> res; vector<pair<ll,int>> w_sort; int n=w.size(); for(int i=0;i<n;i++){ w_sort.push_back({w[i],i}); } sort(w_sort.begin(),w_sort.end(),greater<pair<ll,int>>()); ll sum=0; for(auto p:w_sort){ if(sum+p.first<=u){ sum+=p.first; res.push_back(p.second); } } return (sum>=l)?res:(std::vector<int>(0)); }
#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...