| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1283416 | Leyna | Detecting Molecules (IOI16_molecules) | C++20 | 36 ms | 6176 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<ll, ll>> weights;
for (int i=0; i<n; i++) weights.push_back({w[i], i});
int left = 0, right = 1;
sort(all(weights));
ll sum = weights[0].first;
bool possible = false;
while (left < right && (right < n || (right == n && sum >= l))){
if (sum < l){
sum += weights[right++].first;
}
else if (sum > u){
sum -= weights[left++].first;
}
else{
possible = true;
break;
}
}
//cerr << left << " " << right << endl;
//cerr << "possible: " << possible << endl;
vector<int> result;
if (possible){
for (int i=left; i<right; i++){
result.push_back(weights[i].second);
}
}
return result;
}
컴파일 시 표준 에러 (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... | ||||
