QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394239#4913. 子集匹配henrytb100 ✓756ms20148kbC++14433b2024-04-20 10:29:362024-04-20 10:29:37

Judging History

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

  • [2024-04-20 10:29:37]
  • 评测
  • 测评结果:100
  • 用时:756ms
  • 内存:20148kb
  • [2024-04-20 10:29:36]
  • 提交

answer

#include <bits/stdc++.h>
#include "hall.h"
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
using namespace std;

int solve(int n, int K, int s) {
    // s
    int now = 0, mn = 0, mnid = -1;
    rep(i, 0, n - 1) {
        if (s >> i & 1) ++now;
        else --now;
        if (now <= mn) mn = now, mnid = i;
    }
    s ^= (1 << (mnid + 1));
    return s;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 29ms
memory: 4428kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 63ms
memory: 4736kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 51ms
memory: 4692kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 31ms
memory: 4980kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 112ms
memory: 5824kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 260ms
memory: 8048kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 214ms
memory: 7848kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

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

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 526ms
memory: 12016kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 756ms
memory: 20148kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 686ms
memory: 20148kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 572ms
memory: 20132kb

input:

27 16

output:

OK

result:

ok "OK"