QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101319 | #4913. 子集匹配 | FISHER_ | 100 ✓ | 960ms | 19868kb | C++14 | 211b | 2023-04-29 09:14:50 | 2023-04-29 09:14:54 |
Judging History
answer
#include "hall.h"
int solve(int n, int k, int s) {
int sum = 0, mx = 0, id;
for (int i = 0; i < n; i++) {
sum += ((s >> i) & 1) ? 1 : -1;
if (sum > mx) id = i, mx = sum;
}
return s ^ (1 << id);
}
詳細信息
Test #1:
score: 5
Accepted
time: 2ms
memory: 3464kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 2ms
memory: 3460kb
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: 2ms
memory: 3400kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 4ms
memory: 3532kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 8ms
memory: 3520kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 7ms
memory: 3408kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 5ms
memory: 3532kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 44ms
memory: 3972kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 88ms
memory: 4472kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 75ms
memory: 4416kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 53ms
memory: 4508kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 166ms
memory: 5492kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 358ms
memory: 7560kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 326ms
memory: 7580kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 246ms
memory: 7492kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 725ms
memory: 11584kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 948ms
memory: 19832kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 960ms
memory: 19848kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 949ms
memory: 19868kb
input:
27 16
output:
OK
result:
ok "OK"