| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 500423 | CatalinT | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <iostream>
using namespace std;
using int64 = long long;
auto impossible = vector<int> {};
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> sol;
int64 res = 0;
int N = w.size();
vector<int> order(N);
iota(order.begin(), order.end(), 0);
sort(order.begin(), order.end(), [&](int a, int b){
return w[a] < w[b];
});
for (auto i : order) {
res += w[i];
sol.push_back(i);
if (res >= l)
break;
}
if (res < l)
return impossible;
else if (res <= u)
return sol;
// res > u
int at = 0;
while(at < sol.size()) {
res -= w[sol[at]];
at++;
if (res >= l && res <= u) {
return vector<int>(sol.begin() + at, sol.end());
} else if (res < l) {
return impossible;
}
}
return impossible;
}
// void debug(vector<int> v) {
// for (auto x : v) cerr << x << " "; cerr << "\n";
// }
// int main() {
// debug(find_subset(15, 17, {6, 8, 8, 7}));
// debug(find_subset(14, 15, {5, 5, 6, 6}));
// debug(find_subset(10, 20, {15, 17, 16, 18}));
// return 0;
// }
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
