This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "molecules.h"
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
using namespace std;
const ll N =(1e5+5);
const ll MOD = 10243;
const ll INF = 1e16;
const ll LOG = 29;
long long binpow(long long a, long long b) {
a %= MOD;
long long res = 1;
while (b > 0) {
if (b & 1)
res = (res * a)%MOD ;
a = (a * a)%MOD ;
b >>= 1;
}
res%=MOD;
return res;
}
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
int pre[n];
vector<pair<int,int>> gg;
for(int i = 0;i<n;i++){
gg.pb(mp(w[i],i));
}
sort(all(gg));
pre[0]=gg[0].f;
for(int i =1;i<n;i++){
pre[i]=pre[i-1]+gg[i].f;
}
for(int i =0;i<n;i++){
for(int j = 0;j<n;j++){
int lol;
if(i == 0){
lol = pre[j];
}
else lol = pre[j]-pre[i-1];
if(lol>=l && lol<=u){
vector<int> ans;
for(int k = i;k<=j;k++) ans.pb(gg[k].s);
sort(all(ans));
return ans;
}
}
}
vector<int> ans;
return ans;
}
// int main(){
// vector<int> v;
// v.pb(6);
// v.pb(8);
// v.pb(8);
// v.pb(7);
// vector<int>x = find_subset(15,17,v);
// for(auto xx:x)cout<<xx<<endl;
// return 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... |