# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1127194 | heey | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+2;
#include "molecules.h"
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
vector<pair<int,int>> sigma(n);
for(int i = 0; i < n; i++){
sigma[i] = {w[i], i};
}
sort(sigma.begin(), sigma.end());
vector<bool> us(n, false);
int L = 0, R = n-1;
long long sum = 0;
int t = n-1;
while(L < R && (sum > u || sum < l)){
us[R] = true;
sum += sigma[R--].first;
while(L < R && t > R && sum > u){
us[t] = false;
us[L] = true;
sum -= sigma[t--].first;
sum += sigma[L++].first;
}
}
int res = 0;
vector<int> ans;
for(int i = 0; i < n; i++){
if(us[i]) {
ans.emplace_back(sigma[i].second);
res += sigma[i].first;
}
}
if(res > u || res < l) return vector<int>(0);
sort(ans.begin(), ans.end());
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... |