QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394307 | #4913. 子集匹配 | luanmenglei | 100 ✓ | 758ms | 20128kb | C++17 | 305b | 2024-04-20 11:22:01 | 2024-04-20 11:22:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// #include "hall.h"
int solve(int n, int k, int S) {
int cnt = 0, suf = 0, pos = n;
for (int i = n - 1; i >= 1; i --) {
if (S >> i & 1)
cnt += 1;
else
cnt -= 1;
if (cnt <= suf) {
suf = cnt;
pos = i;
}
}
return S ^ (1 << (pos - 1));
}
詳細信息
Test #1:
score: 5
Accepted
time: 1ms
memory: 3572kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3624kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3752kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3972kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 3ms
memory: 3840kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 6ms
memory: 3644kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 4ms
memory: 3816kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 2ms
memory: 4032kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 36ms
memory: 4088kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 76ms
memory: 4632kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 63ms
memory: 4988kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 37ms
memory: 4704kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 144ms
memory: 5852kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 319ms
memory: 7700kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 252ms
memory: 7776kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 165ms
memory: 7704kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 606ms
memory: 11932kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 758ms
memory: 19988kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 668ms
memory: 20128kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 645ms
memory: 19936kb
input:
27 16
output:
OK
result:
ok "OK"