# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
744353 | Dan4Life | Detecting Molecules (IOI16_molecules) | C++17 | 51 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
using ll = long long;
const int mxN = (int)2e5+10;
ll pre[mxN];
/*
4 15 17
6 8 8 7
*/
vector<int> find_subset(int L, int R, vector<int> w) {
vector<pair<int,int>> v; v.clear();
for(int i = 1; auto u : w) v.pb({u,i++});
sort(all(v)); int n = sz(v); pre[0]=0;
for(int i = 0; i < n; i++)
pre[i+1] = pre[i]+(ll)v[i].first;
vector<int> ans; ans.clear();
for(int i = 0; i < n; i++){
int l = i+1, r = n;
if(pre[r]-pre[i]<L) continue;
while(l<r){
int mid = (l+r)/2;
ll sum = pre[mid]-pre[i];
if(sum<(ll)L) l=mid+1;
else r=mid;
}
ll sum = pre[l]-pre[i];
if(L<=sum and sum<=R){
for(int j = i; j < l; i++) ans.pb(v[j].second);
return ans;
}
}
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... |