# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
229424 | nickmet2004 | Detecting Molecules (IOI16_molecules) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<molecules.h>
#define ll long long
using namespace std;
const int N = 2e5 + 500;
long long pr[N];
vector<int> find_subset(int l , int u , vector<int> w){
int n = w.size();
pr[0] = w[0];
for(int i = 1; i < n; ++i){
pr[i] = pr[i - 1] + w[i];
}
vector<int> res; res.resize(0);
for(int i = 0; i < n; ++i){
int x = pr[i] - l;
int lw = 0 , rh = i;
ll ans = -1;
while(lw <= rh){
int m =(lw + hw) >> 1;
if(w[m] <= x){
ans = m;
l = m + 1;
} else {
r = m - 1;
}
}
if(ans != -1){
if(w[ans] >= l && w[ans] <= u){
for(int k = ans; k <= i; ++i){
res.emplace_back(w[k]);
}return res;
}
}
}
return res;
}