QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#394379 | #4913. 子集匹配 | Jelly_prx | 100 ✓ | 787ms | 20316kb | C++14 | 235b | 2024-04-20 14:05:50 | 2024-04-20 14:05:51 |
Judging History
answer
#include<iostream>
#include<cstdio>
using namespace std;
int solve(int n,int k,int s){
int mn=0,pos=0,tot=0;
for(int i=1;i<=n;i++){
if(s&(1<<i-1)) tot++;
else tot--;
if(tot<=mn) mn=tot,pos=i;
}
return s^(1<<pos);
}
詳細信息
Test #1:
score: 5
Accepted
time: 0ms
memory: 3684kb
input:
14 8
output:
OK
result:
ok "OK"
Test #2:
score: 5
Accepted
time: 1ms
memory: 3676kb
input:
15 8
output:
OK
result:
ok "OK"
Test #3:
score: 5
Accepted
time: 1ms
memory: 3976kb
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: 2ms
memory: 3716kb
input:
18 10
output:
OK
result:
ok "OK"
Test #6:
score: 5
Accepted
time: 5ms
memory: 3672kb
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: 3872kb
input:
19 12
output:
OK
result:
ok "OK"
Test #9:
score: 5
Accepted
time: 26ms
memory: 4488kb
input:
22 12
output:
OK
result:
ok "OK"
Test #10:
score: 5
Accepted
time: 64ms
memory: 4996kb
input:
23 12
output:
OK
result:
ok "OK"
Test #11:
score: 5
Accepted
time: 47ms
memory: 4764kb
input:
23 13
output:
OK
result:
ok "OK"
Test #12:
score: 5
Accepted
time: 33ms
memory: 5004kb
input:
23 14
output:
OK
result:
ok "OK"
Test #13:
score: 5
Accepted
time: 119ms
memory: 5796kb
input:
24 13
output:
OK
result:
ok "OK"
Test #14:
score: 5
Accepted
time: 268ms
memory: 7764kb
input:
25 13
output:
OK
result:
ok "OK"
Test #15:
score: 5
Accepted
time: 221ms
memory: 7740kb
input:
25 14
output:
OK
result:
ok "OK"
Test #16:
score: 5
Accepted
time: 177ms
memory: 7896kb
input:
25 15
output:
OK
result:
ok "OK"
Test #17:
score: 5
Accepted
time: 564ms
memory: 12156kb
input:
26 14
output:
OK
result:
ok "OK"
Test #18:
score: 5
Accepted
time: 787ms
memory: 20108kb
input:
27 14
output:
OK
result:
ok "OK"
Test #19:
score: 5
Accepted
time: 691ms
memory: 20316kb
input:
27 15
output:
OK
result:
ok "OK"
Test #20:
score: 5
Accepted
time: 606ms
memory: 20120kb
input:
27 16
output:
OK
result:
ok "OK"