#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int rad(int a,int b){
return rand()%(b-a+1);
}
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
ll sum=0;
vector<int> ans;
for(int i=0; i<(int)w.size(); i++) {
sum+=w[i];
ans.push_back(w[i]);
if(sum>u) {
int m=rad(0,(int)ans.size());
sum-=ans[m];
ans.erase(ans.begin()+m);
break;
}
}
if(sum>=l&&sum<=u) {
return ans;
}
return std::vector<int>(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |