| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1326533 | rainerevan_ | Detecting Molecules (IOI16_molecules) | C++20 | 32 ms | 4112 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
typedef int ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 5;
const ll LOG = 30;
#define vll vector <ll>
#define pll pair <ll, ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " " << (x) << endl;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vll z;
vector <pll> v;
ll sz = w.size();
for(ll i = 0; i < sz; i++){
if(w[i] >= l){
if(w[i] <= u) return vll (1, i);
}
else v.push_back({w[i], i});
}
sort(v.begin(), v.end());
sz = v.size();
ll tot = 0;
for(ll i = 0; i < sz; i++){
tot += v[i].fi;
if(tot >= l){
if(tot <= u){
for(ll j = 0; j <= i; j++) z.push_back(v[j].se);
sort(z.begin(), z.end());
return z;
}
// dari 0 sampe i-1
tot -= v[i].fi;
for(ll j = 0; j < i; j++){
if(tot-v[j].fi+v[sz-1-j].fi >= l){
for(ll k = j+1; k < i; k++) z.push_back(v[k].se);
for(ll k = sz-1-j; k < sz; k++) z.push_back(v[k].se);
sort(z.begin(), z.end());
return z;
}
tot += -v[j].fi+v[sz-1-j].fi;
}
return std::vector<int>(0);
}
}
return std::vector<int>(0);
}
// 10 11
// 4 4 4 5 5
컴파일 시 표준 에러 (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... | ||||
