Submission #418231

#TimeUsernameProblemLanguageResultExecution timeMemory
418231salehDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms204 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(), sum = 0; int p = 0, q = n; if (accumulate(w.begin(), w.end(), 0ll) < l) return {}; while (sum + w[p] <= u) sum += w[p++]; if (sum >= l) { vector<int> v; for (int i = 1; i <= p; i++) v.push_back(i); return v; } while (sum < l) { sum += w[--q]; sum -= w[--p]; } if (sum < l) return {}; else { vector<int> v; for (int i = 1; i <= p; i++) v.push_back(i); for (int i = n; i > q; i--) v.push_back(i); return v; } } //int main() {}
#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...