#include "molecules.h"
#include <bits/stdc++.h>
//#define int long long
using namespace std;
vector<int> find_subset(int l, int r, vector<int> w){
int n = w.size();
vector< pair<int, int> > v(n);
for(int i = 0; i < n; i++){
v[i] = make_pair(w[i],i);
}
sort(v.begin(), v.end());
vector<bool> taken(n, false);
int left = 0, right = 0;
long long tot = 0;
while(1){
while(right < n && tot < (long long) l){
tot+=(long long) v[right].first;
taken[v[right].first] = true;
right++;
}
while(left < n && tot > (long long) r){
tot-=(long long) v[left].first;
taken[v[left].first] = false;
left++;
}
if(tot >= l && tot <= r){
vector<int> ans(0);
for(int i = 0; i < n; i++){
if(taken[i]) ans.push_back(i);
}
return ans;
}
if(left >= n || right >= n) break;
}
vector<int> ans(0);
return ans;
}
/*
signed main(){
int a, b, c;
cin >> a >> b >> c;
vector<int> v(0);
for(int i = 0; i < a; i++){
int d;
cin >> d;
v.push_back(d);
}
v = find_subset(b,c,v);
cout << v.size() << endl;
for(int i = 0; i < v.size(); i++){
cout << v[i] << ' ';
}
cout << endl;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
484 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
484 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
484 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
484 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
484 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
484 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
484 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
484 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
484 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
484 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |