QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394621#4913. 子集匹配Cloote100 ✓663ms20372kbC++17337b2024-04-20 16:56:272024-04-20 16:56:27

Judging History

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

  • [2024-04-20 16:56:27]
  • 评测
  • 测评结果:100
  • 用时:663ms
  • 内存:20372kb
  • [2024-04-20 16:56:27]
  • 提交

answer

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

int solve(int n,int K,int s){
    int sum=0,mini=0,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: 3772kb

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 37ms
memory: 4500kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 84ms
memory: 5004kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

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

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 42ms
memory: 4620kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 150ms
memory: 5816kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 328ms
memory: 7860kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 258ms
memory: 7920kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 178ms
memory: 8080kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 597ms
memory: 11900kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 663ms
memory: 20296kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 656ms
memory: 20372kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 583ms
memory: 20100kb

input:

27 16

output:

OK

result:

ok "OK"