# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1211840 | Marco_Escandon | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
sort(w.rbegin(),w.rend());
ll ac=0;
vector<ll> ans;
priority_queue<pair<ll,ll>> q;
for(int i=0; i<w.size(); i++)
{
if(ac+w[i]<=u)
{
ac+=w[i];
ans.push_back(i);
if(ac>=l) return ans;
}
else q.push({w[i],i});
}
ll p=ans.size()-1;
while(p>=0&&!q.empty()&&ac<=l&&q.top().first>w[ans[p]])
{
q.push({w[ans[p]],ans[p]});
ac+=q.top().second-w[ans[p]];
ans[p]=q.top().second;
p--;
q.pop();
}
if(ac>=l&&ac<=u) return ans;
ans.clear();
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... |