QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#400973 | #4913. 子集匹配 | 11d10xy | 100 ✓ | 1293ms | 19980kb | C++17 | 276b | 2024-04-27 19:22:59 | 2024-04-27 19:23:00 |
Judging History
answer
#include"hall.h"
int solve(int n,int _,int s){
int a[30]{},m=1,tg=0;
a[1]=0;
for(int i=0;i<n;i++)if(s>>i&1&&(a[m]|tg)!=(s&(1<<i)-1))
m--,tg|=1<<i;
else a[m+1]=a[m]|1<<i,m++;
for(int i=1;i<=m;i++)if((a[i]|tg)==s)return a[i-1]|tg;
return -114514;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 0ms
memory: 3956kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3796kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3732kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3600kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 4ms
memory: 3772kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 8ms
memory: 3700kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 7ms
memory: 3808kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 5ms
memory: 3792kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 52ms
memory: 4152kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 117ms
memory: 4972kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 99ms
memory: 4972kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 74ms
memory: 4968kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 220ms
memory: 6000kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 505ms
memory: 8040kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 418ms
memory: 7824kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 310ms
memory: 7832kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 972ms
memory: 11860kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 1187ms
memory: 19980kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 1293ms
memory: 19976kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 1170ms
memory: 19976kb
input:
27 16
output:
OK
result:
ok "OK"