| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1313943 | voldi9 | Detecting Molecules (IOI16_molecules) | C++20 | 34 ms | 3740 KiB |
#include "molecules.h"
#include <iostream>
#include <vector>
#include <span>
#include <algorithm>
using namespace std;
vector<int> map_to_second(span<pair<int,int>> s) {
vector<int> res{};
for (auto &el : s)
res.push_back(el.second);
return res;
}
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int, int>> items(w.size());
for (int i = 0; i < w.size(); i++) {
items[i] = {w[i], i};
}
sort(items.begin(), items.end());
int p1=0, p2=0;
long long sum = 0;
while (p1 < w.size()) {
while (sum < l && p2 < w.size())
sum += items[p2++].first;
while (sum > u && p1 < w.size())
sum -= items[p1++].first;
if (sum >= l)
return map_to_second(span<pair<int,int>>(items.begin() + p1, items.begin() + p2));
else if (p2 >= w.size()) return {};
}
}
컴파일 시 표준 에러 (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... | ||||
