Submission #641642

#TimeUsernameProblemLanguageResultExecution timeMemory
641642deviceDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms212 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); vector<pair<int,int>> v(n); for (int i = 0; i < n; i++) cin >> v[i].first, v[i].second = i; sort(v.begin(), v.end()); int cur = 0, ptr = 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...