#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
ll n = w.size();
ll sum = 0;
vpll v(n);
loop(i,0,n) v[i] = {w[i], i};
sort(all(v));
loop(i,0,n) {
if (v[i].first == l || v[i].first == u) return {(int)v[i].second};
}
for (auto [x,idx] : v) {
if (x>=l && x<=u) {
return {(int)idx};
}
auto it = lower_bound(v.begin(), v.end(), make_pair(u - x, -inf));
if (it!= v.end()){
ll sec = it->second;
if (sec!= idx)return {(int)idx, (int)sec};
it++;
if (it == v.end()) break;
if (it->first == u-x) {
ll sec = it->second;
if (sec!= idx)return {(int)idx, (int)sec};
}
}
it = lower_bound(v.begin(), v.end(), make_pair(l - x, -inf));
if (it!= v.end()){
ll sec = it->second;
if (sec!= idx)return {(int)idx, (int)sec};
it++;
if (it == v.end()) break;
if (it->first == l-x) {
ll sec = it->second;
if (sec!= idx)return {(int)idx, (int)sec};
}
}
}
return {};
}
컴파일 시 표준 에러 (stderr) 메시지
molecules.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | 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... |