QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#148962 | #4913. 子集匹配 | zhouhuanyi | 100 ✓ | 736ms | 20012kb | C++14 | 249b | 2023-08-23 21:04:14 | 2023-08-23 21:04:16 |
Judging History
answer
#include "hall.h"
#include<cstdio>
using namespace std;
int solve(int n,int K,int s)
{
int cnt=0,rt=0,minn=0;
for (int i=1;i<=n;++i)
{
if (s&(1<<(i-1))) cnt++;
else cnt--;
if (cnt<=minn) minn=cnt,rt=i;
}
return s^(1<<rt);
}
詳細信息
Test #1:
score: 5
Accepted
time: 1ms
memory: 3632kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 0ms
memory: 3704kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3628kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3624kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 1ms
memory: 3668kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 6ms
memory: 3572kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 2ms
memory: 3688kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 3ms
memory: 3516kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 33ms
memory: 4140kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 68ms
memory: 4720kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 57ms
memory: 4532kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 40ms
memory: 4672kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 128ms
memory: 5552kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 312ms
memory: 7588kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 246ms
memory: 7776kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 169ms
memory: 7616kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 560ms
memory: 11884kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 713ms
memory: 19880kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 735ms
memory: 19880kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 736ms
memory: 20012kb
input:
27 16
output:
OK
result:
ok "OK"