Submission #502116

#TimeUsernameProblemLanguageResultExecution timeMemory
502116MurotYDetecting Molecules (IOI16_molecules)C++14
9 / 100
0 ms204 KiB
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector <pair <ll,ll> > a(w.size()); int n=w.size(); for (int i=0;i<n;i++) a[i].first=w[i], a[i].second=i; sort(a.begin(),a.end()); for (int i=0;i<n;i++){ long long sum=0, q=0; while (q < n && sum < l) sum+=a[q].first, q++; if (sum >= l and sum > u){ return vector <int> (); } if (sum >= l && sum <= u){ vector <int> ans; for (int i=0;i<q;i++) ans.push_back(a[i].second); return ans; } } return vector <int> (); }
#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...