Submission #690582

#TimeUsernameProblemLanguageResultExecution timeMemory
690582zeroesandonesDetecting Molecules (IOI16_molecules)C++17
69 / 100
1078 ms6488 KiB
#include "bits/stdc++.h" #include "molecules.h" using namespace std; using ll = long long; using pi = pair<long long, long long>; using vi = vector<long long>; #define pb emplace_back vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pi> val; for(int i = 0; i < n; ++i) { val.pb(w[i], i); } sort(val.begin(), val.end()); pi ans = {-1, -1}; for(int i = 0; i < n; ++i) { ll sum = 0; for(int j = i; j < n; ++j) { sum += val[j].first; if(l <= sum && sum <= u) { ans = {i, j}; } } } vector<int> res; pi bad = {-1, -1}; if(ans == bad) { return res; } for(int i = ans.first; i <= ans.second; ++i) { res.pb(val[i].second); } return res; }
#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...