# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132457 | bogdan10bos | Detecting Molecules (IOI16_molecules) | C++14 | 68 ms | 6512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/// inapt
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<int> ord;
for(int i = 0; i < w.size(); i++) ord.push_back(i);
sort(ord.begin(), ord.end(),
[&](int a, int b) { return w[a] < w[b]; } );
vector<LL> sum(w.size());
LL s = 0;
for(int i = 0; i < w.size(); i++)
{
s += w[ ord[i] ];
sum[i] = s;
}
vector<int> ans;
if(l <= s && s <= u)
{
sort(ord.begin(), ord.end());
return ord;
}
int L = l, R = u, N = w.size();
for(int i = 0; i < w.size(); i++)
{
if(sum[i] > R) break;
//if(s - sum[N - i - 2] < L) continue;
int lgt = i + 1;
int st = 0, dr = N - lgt;
while(st <= dr)
{
int mij = st + (dr - st) / 2;
LL ss = sum[mij + lgt - 1];
if(mij > 0) ss -= sum[mij - 1];
if(ss <= R)
{
if(ss >= L)
{
int j = mij;
for(int k = j; k < j + lgt; k++) ans.push_back(ord[k]);
sort(ans.begin(), ans.end());
return ans;
}
st = mij + 1;
}
else
dr = mij - 1;
}
}
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... |