# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1266604 | thewizardman | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
ll n, mn, mx;
vector<pll> v;
vector<int> ans;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
n = w.size();
v.resize(n);
for (int i = 0; i < n; i++) v[i] = {w[i], i};
sort(v.begin(), v.end());
for (int i = 0; i < n; i++) {
mn += v[i].first;
mx += v[n-i-1].first;
if (mn <= u && mx >= l) {
for (int j = 0; j <= i; j++) ans.push_back(i);
while (mn < l) {
auto it = prev(lower_bound(ans.begin(), ans.end(), n-1));
mn -= v[*it].first;
(*it)++;
mn += v[*it].first;
}
break;
}
}
for (auto &e: ans) e = v[e].second;
return ans;
}
컴파일 시 표준 에러 (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... |