QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101398 | #4913. 子集匹配 | lingchen | 100 ✓ | 1062ms | 19876kb | C++14 | 200b | 2023-04-29 14:23:46 | 2023-04-29 14:23:49 |
Judging History
answer
#include "hall.h"
int solve(int n, int K, int s)
{
int pos=0,minn=0;
for(int i=0,now=0; i<n; i++)
{
now+=((s>>i)&1) ? 1 : -1;
if(now<=minn) minn=now, pos=i+1;
}
return s^(1<<pos);
}
详细
Test #1:
score: 5
Accepted
time: 2ms
memory: 3376kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 2ms
memory: 3384kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 2ms
memory: 3496kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3536kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 1ms
memory: 3532kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 7ms
memory: 3556kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 6ms
memory: 3588kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 5ms
memory: 3668kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 41ms
memory: 3896kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 90ms
memory: 4528kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 63ms
memory: 4520kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 45ms
memory: 4628kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 164ms
memory: 5480kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 374ms
memory: 7528kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 308ms
memory: 7588kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 224ms
memory: 7624kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 730ms
memory: 11720kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 1051ms
memory: 19808kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 1062ms
memory: 19876kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 886ms
memory: 19868kb
input:
27 16
output:
OK
result:
ok "OK"