QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#75586 | #4913. 子集匹配 | 4182_543_731 | 100 ✓ | 958ms | 19972kb | C++ | 176b | 2023-02-05 20:52:36 | 2023-02-05 20:52:38 |
Judging History
answer
#include "hall.h"
int solve(int n,int K,int s)
{
int nw=0,mn=0,as=0;
for(int i=1;i<=n;i++)
{
nw+=(s>>i-1)&1?1:-1;
if(nw<=mn)mn=nw,as=i;
}
return s-(1<<as);
}
详细
Test #1:
score: 5
Accepted
time: 2ms
memory: 3364kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 2ms
memory: 3600kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 2ms
memory: 3552kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3584kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 5ms
memory: 3576kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 8ms
memory: 3588kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 3ms
memory: 3488kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 2ms
memory: 3592kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 40ms
memory: 4092kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 87ms
memory: 4604kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 68ms
memory: 4452kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 50ms
memory: 4448kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 161ms
memory: 5696kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 359ms
memory: 7460kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 307ms
memory: 7516kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 216ms
memory: 7712kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 710ms
memory: 11608kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 958ms
memory: 19804kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 842ms
memory: 19908kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 837ms
memory: 19972kb
input:
27 16
output:
OK
result:
ok "OK"