Submission #594945

#TimeUsernameProblemLanguageResultExecution timeMemory
594945LucppDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms300 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int sum = 0, i = 0, n = (int)w.size(); vector<pair<int, int>> a(n); for(int i = 0; i < n; i++) a[i] = {w[i], i}; sort(a.begin(), a.end()); vector<int> v; while(i < n && sum < u-a[i].first) v.push_back(a[i].second), sum += a[i++].first; if(sum >= l) return v; for(int j = 1; j <= i; j++){ sum -= a[i-j].first; sum += a[n-j].first; v[i-j] = a[n-j].second; if(sum >= l) return v; } return {}; }
#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...