# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1137253 | rayan_bd | Detecting Molecules (IOI16_molecules) | C++20 | 33 ms | 4024 KiB |
#include <bits/stdc++.h>
using namespace std;
#define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i]
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define br cout<<"\n"
#define pb push_back
#define nl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ret return
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define fi first
#define se second
const int mxN = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
vector<int> find_subset(int L,int R,vector<int> w){
int n=w.size();
vector<pair<int,int>> vec;
for(int i=0;i<n;++i){
vec.push_back({w[i],i});
}
sort(all(vec));
vector<int> ans;
int i=0,j=0,sum=0;
while(j<n){
sum+=vec[j].fi;
while(sum>R&&i<=j){
sum-=vec[i++].fi;
}
if(i<=j&&sum>=L&&sum<=R){
ll tot=0;
while(i<=j){
tot+=vec[i].fi;
ans.pb(vec[i++].se);
}
return ans;
}
++j;
}
return ans;
}
Compilation message (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... |