이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e18;
const int i_inf = 1e9;
const ll mod = 1e9+7;
mt19937 _rand(time(NULL));
const int mxn = 1e5+5;
#include "molecules.h"
std::vector<int> find_subset(int l, int r, std::vector<int> w){
if(l == 0) return std::vector<int>(0);
int n = (int)w.size();
sort(all(w));
fr(i, 0, n){
ll s = 0;
vector<int> pot;
fr(j, i, n){
pot.pb(j);
s += w[j];
if(l <= s && s <= r){
return pot;
}
}
}
return std::vector<int>(0);
/*int n = (int)w.size();
sort(all(w));
int lp = 0;
int rp = 0;
ll sum = 0;
while(rp < n && sum < l){
sum += w[rp++];
while(lp < rp && sum > r){
sum -= w[lp++];
}
}
if(l <= sum && sum <= r){
vector<int> sol;
while(lp < rp) sol.pb(lp++);
return sol;
}
return std::vector<int>(0);*/
}
# | 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... |