# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1023716 | vjudge1 | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl "\n"
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define show(x); cerr << #x << " is " << x << nl;
#define show2(x,y); cerr << #x << " is " << x << " " << #y << " is " << y << nl;
#define show3(x,y,z); cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << nl;
#define showall(x); cerr << #x << " is "; for (auto i : x) {cerr << i << " ";} cerr << nl;
vector<int> find_subset(int l, int u, vector<int> w){
ll n = w.size();
vector<pi> num(n, mp(0, 0));
for (ll i=0; i<w.size(); i++) num[i] = mp(w[i], i);
sort(num.begin(), num.end());
ll sum = 0, start = 0;
while(start<n && sum<l){
sum += num[start].ff;
start++;
}
if (start==1) return {num[0].ss};
else if (sum<l) return {};
ll front=-1, back=-1;
if(sum>=l && sum<=u){
front = 0;
back = start-1;
}
else{
ll size = start-1; // 0 to start-2
sum -= num[start-1].ff;
for (ll i=start-1; i<n; i++){
sum -= num[i-size].ff;
sum += num[i].ff;
if(sum>=l && sum<=u){
front = i-size+1;
back = i;
break;
}
}
}
vector<int> v;
if(front==-1 && back==-1) return v;
for (ll i=front; i<=back; i++){
v.push_back(num[i].ss);
}
return v;
}
컴파일 시 표준 에러 (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... |