Submission #641649

#TimeUsernameProblemLanguageResultExecution timeMemory
641649deviceDetecting Molecules (IOI16_molecules)C++17
100 / 100
57 ms5536 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(), ptr = 0; vector<pair<int,int>> v(n); for (int i = 0; i < n; i++) v[i].first = w[i], v[i].second = i; sort(v.begin(), v.end()); long long cur = 0; for (int i = 0; i < n; i++) { cur += v[i].first; while (cur > u && ptr <= i) { cur -= v[ptr].first; ptr++; } if (cur >= l && cur <= u) { vector<int> ret; for (int j = ptr; j <= i; j++) ret.push_back(v[j].second); return ret; } } return 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...