QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393970#4913. 子集匹配NATURAL6100 ✓837ms20348kbC++14246b2024-04-19 19:06:122024-04-19 19:06:13

Judging History

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

  • [2024-04-19 19:06:13]
  • 评测
  • 测评结果:100
  • 用时:837ms
  • 内存:20348kb
  • [2024-04-19 19:06:12]
  • 提交

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);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 5
Accepted
time: 1ms
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: 0ms
memory: 3816kb

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

score: 5
Accepted
time: 0ms
memory: 3812kb

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

score: 5
Accepted
time: 5ms
memory: 3812kb

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 26ms
memory: 4088kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

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

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 44ms
memory: 4828kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 36ms
memory: 5008kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 132ms
memory: 5632kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 273ms
memory: 7700kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 216ms
memory: 8076kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 152ms
memory: 7772kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 549ms
memory: 11836kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 837ms
memory: 20348kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 761ms
memory: 20348kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 675ms
memory: 20052kb

input:

27 16

output:

OK

result:

ok "OK"