# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1173956 | HappyCapybara | Detecting Molecules (IOI16_molecules) | C++17 | 1096 ms | 328 KiB |
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> W;
vector<int> mstv(multiset<int> ms){
vector<int> v;
for (int i=0; i<W.size(); i++){
if (ms.find(W[i]) != ms.end()){
ms.erase(ms.find(W[i]));
v.push_back(i);
}
}
return v;
}
vector<int> find_subset(int l, int u, vector<int> w){
W = w;
int n = w.size();
sort(w.begin(), w.end());
int cur = 0;
multiset<int> res;
for (int i=0; i<n; i++){
res.insert(w[i]);
cur += w[i];
if (cur > u){
cur -= *res.begin();
res.erase(res.begin());
int j = i;
while (cur < l && j < n){
cur -= *res.begin();
res.erase(res.begin());
cur += w[j];
res.insert(w[j]);
j++;
}
if (l <= cur && cur <= u) return mstv(res);
else return {};
}
else if (cur >= l) return mstv(res);
}
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... |