QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#393969#4913. 子集匹配NATURAL6100 ✓696ms20344kbC++14259b2024-04-19 19:02:452024-04-19 19:02:45

Judging History

你现在查看的是最新测评结果

  • [2024-04-19 19:02:45]
  • 评测
  • 测评结果:100
  • 用时:696ms
  • 内存:20344kb
  • [2024-04-19 19:02:45]
  • 提交

answer

#include<bits/stdc++.h>
#include "hall.h"
using namespace std;
int solve(int n,int K,int S)
{
    int p=0;
    for(int i=1,pre=0,mn=0;i<=n;++i)
    {
        pre+=(((S>>(i-1))&1)?1:-1);
        if(pre<=mn)mn=pre,p=i;
    }
    return S^(1<<p);
}

詳細信息

Test #1:

score: 5
Accepted
time: 1ms
memory: 3972kb

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

score: 5
Accepted
time: 1ms
memory: 3744kb

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

score: 5
Accepted
time: 1ms
memory: 3680kb

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

score: 5
Accepted
time: 1ms
memory: 3616kb

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

score: 5
Accepted
time: 2ms
memory: 4000kb

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: 3672kb

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

score: 5
Accepted
time: 2ms
memory: 3868kb

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 30ms
memory: 4120kb

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: 52ms
memory: 4668kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 32ms
memory: 4992kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 121ms
memory: 5788kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 264ms
memory: 7896kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 223ms
memory: 7844kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 155ms
memory: 7852kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 543ms
memory: 12164kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 696ms
memory: 20116kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 658ms
memory: 20344kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 653ms
memory: 20140kb

input:

27 16

output:

OK

result:

ok "OK"