| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1307732 | ayaz | Detecting Molecules (IOI16_molecules) | C++20 | 37 ms | 5296 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define isz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
using vi = vector<int>;
using ll = long long;
using vl = vector<ll>;
using pii = pair<int, int>;
vi find_subset(int l, int r, vi w) {
int n = isz(w);
vector<array<int, 2>> a(n);
vl pre(n);
for (int i = 0; i < n; i++) a[i] = {w[i], i};
sort(all(a));
for (int i = 0; i < n; i++) pre[i] = (i == 0 ? a[i][0] : a[i][0] + pre[i - 1]);
for (int i = 0; i < n; i++) {
int low = i, high = n - 1;
auto check = [&](int x) -> bool {
return (pre[x] - (i == 0 ? 0 : pre[i - 1]) < l);
};
while (low <= high) {
int mid = (low + high) >> 1;
if (check(mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
ll sum = pre[low] - (i == 0 ? 0 : pre[i - 1]);
if (l <= sum && sum <= r) {
vi idx;
for (int j = i; j <= low; j++) idx.push_back(a[j][1]);
return idx;
}
}
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... | ||||
