QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394277 | #4913. 子集匹配 | linweitong | 100 ✓ | 938ms | 20088kb | C++20 | 233b | 2024-04-20 10:43:54 | 2024-04-20 10:43:56 |
Judging History
answer
#include"hall.h"
using namespace std;
int solve(int n,int K,int s){
int o=0,ss=n,mn=0;
for (int i=0;i<n;++i){
int j=((s>>i)&1);
o+=(j==1?1:(-1));
if (o<=ss)ss=o,mn=i+1;
}
if (ss>0)return s^1;
return s^(1<<mn);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 1ms
memory: 3672kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3608kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3684kb
input:
15 9
output:
OK
result:
ok "OK"
Test #4:
score: 5
Accepted
time: 1ms
memory: 3796kb
input:
15 10
output:
OK
result:
ok "OK"
Test #5:
score: 5
Accepted
time: 2ms
memory: 3780kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 5ms
memory: 3796kb
input:
19 10
output:
OK
result:
ok "OK"
Test #7:
score: 5
Accepted
time: 4ms
memory: 3808kb
input:
19 11
output:
OK
result:
ok "OK"
Test #8:
score: 5
Accepted
time: 2ms
memory: 3872kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 28ms
memory: 4116kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 61ms
memory: 4996kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 48ms
memory: 4956kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 34ms
memory: 4832kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 112ms
memory: 5732kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 255ms
memory: 8028kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 207ms
memory: 7908kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 152ms
memory: 8064kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 532ms
memory: 11924kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 938ms
memory: 19984kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 760ms
memory: 20064kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 751ms
memory: 20088kb
input:
27 16
output:
OK
result:
ok "OK"