# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
138958 | SirCeness | Detecting Molecules (IOI16_molecules) | C++14 | 67 ms | 7336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define orta ((l+r)>>1)
#define INF 1000000009
#define mod 1000000007
#define ppair(x); cerr << "(" << x.first << ", " << x.second << ")\n";
#define bas(x) #x << ": " << x << " "
#define prarr(x, n); cerr << #x << ": "; for(int qsd = 0; qsd < n; qsd++) cerr << x[qsd] << " "; cerr << "\n";
#define prarrv(x); cerr << #x << ": "; for(int qsd = 0; qsd < (int)x.size(); qsd++) cerr << x[qsd] << " "; cerr << "\n";
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<ll, int> > arr(w.size());
for (int i = 0; i < w.size(); i++){
arr[i] = mp(w[i], i);
}
int anssize = -1;
ll pre = 0, suf = 0;
ll top = 0;
sort(arr.begin(), arr.end());
for (int i = 0; i < w.size(); i++){
pre += arr[i].first;
suf += arr[arr.size()-i-1].first;
// cout << bas(i) << bas(pre) << bas(suf) << endl;
if (pre <= u && l <= suf){
anssize = i+1;
top = pre;
break;
}
}
vector<int> ans(0);
if (anssize == -1) return ans;
ans.resize(anssize);
for (int i = 0; i < ans.size(); i++) ans[i] = arr[i].second;
int ind = 0;
while (top < l){
ans[ind] = arr[arr.size()-ind-1].second;
top += arr[arr.size()-ind-1].first - arr[ind].first;
ind++;
}
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... |