#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
#define rep(i, a, n) for(int i = a; i < n; ++i)
#define rep0(i, n) rep(i, 0, n)
#define rep1(i, n) rep(i, 1, n+1)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define IOS cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define _ << " " <<
#define endl '\n'
#define wer(x) cout << (#x) << "->" << (x) << endl;
#define we(x) (#x) << ":(" << x << ") "
//////////////////////////////////////////////////////////////////
const int maxn = 2e5+50;
vector<ii> item;
vector<int> find_subset(int l, int r, vector<int> w) {
int n = (int) w.size();
rep0(i, n) item.eb(w[i], i + 1);
sort(item.begin(), item.end());
vector<int> ans;
queue<ii> q;
int sum = 0;
for(auto i : item) {
//while(!q.empty() && i.fs - q.front().fs > r - l) sum -= q.front().fs, q.pop();
q.push(i); sum += i.fs;
while(!q.empty() && sum > r) {
sum -= q.front().fs, q.pop();
}
if(sum <= r && sum >= l) {
while(!q.empty()) {
ans.pb(q.front().sc);
q.pop();
}
break;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
384 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
3 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
3 ms |
384 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
2 ms |
384 KB |
OK (n = 12, answer = NO) |
5 |
Incorrect |
2 ms |
384 KB |
sum of weights should be in [290..300] but it is 301 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
384 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
384 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
384 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
384 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |