QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394219 | #4913. 子集匹配 | cz_yxx | 100 ✓ | 514ms | 20364kb | C++20 | 207b | 2024-04-20 10:23:09 | 2024-04-20 10:23:11 |
Judging History
answer
#include "hall.h"
int solve(int n, int k, int s){
int p = 0, m = 0;
for (int i = 0, w = 0; i < n; w >= m && (p = i + 1, m = w), ++i)
(s >> i & 1) ? --w : ++w;
return s ^ (1 << p);
}
详细
Test #1:
score: 5
Accepted
time: 1ms
memory: 3628kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3780kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3832kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 0ms
memory: 3824kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 2ms
memory: 3796kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 4ms
memory: 3836kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 3ms
memory: 4052kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 0ms
memory: 4016kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 27ms
memory: 4264kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 55ms
memory: 4800kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 46ms
memory: 4780kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 32ms
memory: 4688kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 107ms
memory: 5716kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 232ms
memory: 7920kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 188ms
memory: 7856kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 138ms
memory: 7864kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 445ms
memory: 11952kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 511ms
memory: 20332kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 477ms
memory: 20140kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 514ms
memory: 20364kb
input:
27 16
output:
OK
result:
ok "OK"