# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
281873 | A02 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<pair<int, int> > w2;
for (int i = 0; i < w.size(); i++){
w2.push_back(make_pair(w[i], i));
}
sort(w2.begin(), w2.end());
long long total = 0;
set<int> result;
int i = 0;
for (; (i < w2.size()) && (total + w2[i].first <= u); i++){
total += w2[i].first;
result.insert(w2[i].second);
}
int result_size = i;
if (i == 0){
return vector<int> (0);
}
long long max_total = 0;
for (int j = w2.size() - 1; j >= w2.size() - result_size; j--){
max_total += w2[j].first;
}
if (max_total < l){
return vector<int> (0);
}
int current_lower_max = i - 1;
while (total < l){
result.erase(w2[current_lower_max].second);
result.insert(w2[w2.size() - 1 - (i - 1 - current_lower_max)].second);
total += w2[w.size() - 1 - (i - current_lower_max)].first;
total -= w2[current_lower_max].first;
current_lower_max--;
}
vector<int> r;
for (multiset<int>::iterator it = result.begin(); it != result.end(); it++){
r.push_back(*(it));
}
return r;
}
컴파일 시 표준 에러 (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... |