#include "molecules.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;
bool DEBUG = 0;
const int MAXN = 200005;
vector<int> find_subset(int L, int R, vector<int> w)
{
int n = w.size();
vector<ii> a;
for(int i=0;i<n;i++){
a.pb({w[i],i+1});
}
sort(a.begin(), a.end());
ll Min=0,Max=0;
for(int z=0;z<n;z++)
{
Min+=a[z].F;
Max+=a[n-1-z].F;
if(L<=Max && Min<=R)
{
deque<int> ans;
fore(i,0,z) ans.pb(a[i].S);
ll sum=Min;
int r=n-1;
while(1)
{
if(sum>=L){
vector<int> fa;
for(int x: ans) fa.pb(x);
return fa;
}
sum-=ans.front(); ans.pop_front();
sum+=a[r].F; ans.push_back(a[r].S); r--;
}
}
}
return vector<int>();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Integer 12 violates the range [0, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |