#include "molecules.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const int inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> vv,vec;
set<PII> v;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
for(int i=0;i<(int)w.size();i++){
v.insert({w[i],i});
}
while(l>0){
auto it=v.upper_bound({l,-inf});
PII p1=*it;
//~ cout<<p1.fi<<endl;;
if(p1.fi>=l && p1.fi<=u){
vv.pb(p1.se);
u-=p1.fi;
l-=p1.fi;
break;
}
if(it==v.begin()){
vv=vec;
//~ l-=*it;
//~ u-=*it;
break;
}
it--;
PII p=*it;
vv.pb(p.se);
l-=p.fi;
u-=p.fi;
v.erase(it);
//~ cout<<l<<endl;
}
if(u<0 || l>0)vv=vec;
return vv;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
4 ms |
384 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
4 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
4 ms |
384 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
5 ms |
384 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
4 ms |
256 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
256 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
4 ms |
384 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
4 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
4 ms |
384 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
5 ms |
384 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
4 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
4 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
4 ms |
384 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
4 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
4 ms |
384 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
5 ms |
384 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
4 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
4 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
4 ms |
384 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
4 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
4 ms |
384 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
5 ms |
384 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
4 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
4 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
4 ms |
384 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
384 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
4 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
4 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
4 ms |
384 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
5 ms |
384 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
4 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
4 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |