QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394619#4913. 子集匹配Cloote80 1063ms20124kbC++14360b2024-04-20 16:54:562024-04-20 16:54:56

Judging History

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

  • [2024-04-20 16:54:56]
  • 评测
  • 测评结果:80
  • 用时:1063ms
  • 内存:20124kb
  • [2024-04-20 16:54:56]
  • 提交

answer

#include<bits/stdc++.h>
#include"hall.h"
using namespace std;

int solve(int n,int K,int s){
    int sum=0,mini=(int)1e9,pos=0;
    for(int i=1;i<=n;++i){
        if((s>>(n-i))&1) sum++;
        else sum--;
        if(sum<=mini){
            mini=sum;
            pos=i;
        }
    }
    // cout<<n-pos-1<<" ";
    return s^(1<<(n-pos-1));
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

score: 0
Runtime Error

input:

15 8

output:


result:


Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

score: 0
Runtime Error

input:

19 10

output:


result:


Test #7:

score: 5
Accepted
time: 4ms
memory: 3796kb

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 39ms
memory: 4320kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 0
Runtime Error

input:

23 12

output:


result:


Test #11:

score: 5
Accepted
time: 67ms
memory: 4960kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

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

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 157ms
memory: 5660kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 0
Runtime Error

input:

25 13

output:


result:


Test #15:

score: 5
Accepted
time: 299ms
memory: 7676kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

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

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 841ms
memory: 11924kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 1063ms
memory: 20124kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 899ms
memory: 20112kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 1012ms
memory: 20112kb

input:

27 16

output:

OK

result:

ok "OK"