#include <bits/stdc++.h>
using namespace std;
#define ll int
#define vl vector<ll>
#define vb vector<bool>
#define ed "\n"
#define fi first
#define se second
#define pll pair<ll, ll>
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define pb push_back
#define all(aaa) aaa.begin(), aaa.end()
vector<int> find_subset(int l, int u, vector<int> w){
vector<pll> arr;
ff(i, 0, w.size()){
arr.pb({w[i], i});
}
map<ll, vl> mp;
ll n = arr.size(), r = u-1;
sort(all(arr));
ff(i, 0, n){
//cout << i << ed;
for(auto &[id, val] : mp){
//cout << id << ed;
if(id > r){
break;
}
mp[id+arr[i].fi] = val;
mp[id+arr[i].fi].pb(arr[i].se);
if(l <= id+arr[i].fi && id+arr[i].fi <= r){
return mp[id+arr[i].fi];
}
}
vl a = {arr[i].se};
mp[arr[i].fi] = a;
if(l <= arr[i].fi && arr[i].fi <= r){
return mp[arr[i].fi];
}
}
return {};
}
/*
int main(){
ll a, b;
cin >> a >> b;
vl arr;
ll p;
while(cin >> p){
arr.pb(p);
}
/*ff(i, 0, arr.size()){
cout << arr[i] << " ";
}
cout << ed;
vl other = find_subset(a, b, arr);
ff(i, 0, other.size()){
cout << other[i] << " ";
}
return 0;
}
*/
Compilation message (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... |