| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1319075 | tkm_algorithms | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 332 KiB |
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
using ll = long long;
//#define int ll
using P = pair<int, int>;
#define all(x) x.begin(), x.end()
#define rep(i, l, n) for (int i = l; i < (n); ++i)
#define sz(x) (int)x.size()
const char nl = '\n';
const int mod = 1e9+7;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<P> nw;
rep(i, 0, sz(w))nw.push_back(P(w[i], i));
sort(all(nw));
int sm = 0;
vector<int> res;
for (int i = sz(w)-1; i >= 0; --i) {
sm += nw[i].first;
res.push_back(nw[i].second);
if (sm >= l)break;
}
if (sm < l || nw[0].first > u)return {};
if (sm >= l && sm <= u)return res;
res.erase(res.begin());
if (res.back() == nw[0].second)return {};
sm = sm-nw.back().first+nw[0].first;
if (sm < l || sm>u)return {};
res.push_back(nw[0].second);
return res;
}
//int main() {
//int n; cin >> n;
//vector<int> w(n);
//for (auto &i: w)cin >> i;
//int l, u; cin >> l >> u;
//vector<int> res = find_subset(l, u, w);
//set<int> s;
//for (auto i: res)s.insert(i);
//int sm = 0;
//for (auto i: res)sm += w[i];
//if (sz(s) == sz(res) && !res.empty() && sm >= l && sm <= u)cout << "YES" << nl;
//else cout << "NO" << nl;
//return 0;
//}
컴파일 시 표준 에러 (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... | ||||
