제출 #409609

#제출 시각아이디문제언어결과실행 시간메모리
409609DBPhoenixDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> using namespace std; #include "molecules.h" std::vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); int n = w.size(); int length = 0; long long sum = 0; for (; length < n; length++) { if (sum + w[length] <= u) { sum += w[length]; } else break; } vector<int> result(length); for (int i = 0; i < length; i++) { result[i] = w[i]; } if (sum >= l) { return result; } for (int i = length - 1; i >= 0; i--) { sum -= result[i]; result[i] = w[n - length + i]; sum += result[i]; if (sum >= l) { return result; } } return std::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...