# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72574 | aleksam | Detecting Molecules (IOI16_molecules) | C++14 | 5 ms | 740 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma once
#include <bits/stdc++.h>
#define MAX_N 500000
using namespace std;
long long L[MAX_N], D[MAX_N];
int N;
set<long long> S;
vector<int> find_subset(int l, int u, vector<int> w) {
N=w.size();
sort(w.begin(), w.end());
L[0]=w[0];
for(int i=0; i<N; ++i){
if(i)
L[i]=L[i-1]+w[i];
if(L[i]>=l && L[i]<=u){
vector<int> ret;
for(int j=0; j<i+1; ++j){
ret.push_back(j);
}
return ret;
}
}
D[N-1]=w[N-1];
for(int i=N-1; i>=0; --i){
if(N-1-i)
D[i]=D[i+1]+w[i];
if(D[i]>=l && D[i]<=u){
vector<int> ret;
for(int j=N-1; j>=i; --j){
ret.push_back(j);
}
return ret;
}
}
for(int i=N-2; i>=0; --i){
S.insert(D[i+1]);
auto x=S.lower_bound((long long)l-L[i]);
if(x==S.end())continue;
long long val=*x;
if(val<=(long long)u-L[i]){
//To je to, nasao sam resenje
vector<int> ret;
int ind=-1;
for(int j=i+1; j<N; ++j)
if(D[j]==val)
ind=j;
int sum=0;
for(int j=0; j<=i; ++j){
ret.push_back(j);
sum+=w[j];
}
assert(sum==L[i]);
for(int j=ind; j<N; ++j){
ret.push_back(j);
sum+=w[j];
}
assert(sum==L[i]+D[ind]);
//assert(sum<=u && sum>=l);
return ret;
}
}
vector<int> ret;
return ret;
}
컴파일 시 표준 에러 (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... |