QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394498#4913. 子集匹配jiajia100 ✓527ms20152kbC++20261b2024-04-20 15:19:142024-04-20 15:19:15

Judging History

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

  • [2024-04-20 15:19:15]
  • 评测
  • 测评结果:100
  • 用时:527ms
  • 内存:20152kb
  • [2024-04-20 15:19:14]
  • 提交

answer

#include "hall.h"
#include <cstdio>
using namespace std;

int solve(int n, int K, int s) {
	int p = -1, mn = 0, w = 0;
	for (int i = 0; i < n; i++) {
		if (s >> i & 1) w++;
		else w--;
		if (w <= mn) p = i, mn = w;
	}
	return s ^ (1 << (p + 1));
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

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

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

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

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

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

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

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

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 116ms
memory: 5768kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 247ms
memory: 7756kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 205ms
memory: 8088kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 142ms
memory: 7788kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 464ms
memory: 11816kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 527ms
memory: 20008kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 522ms
memory: 20008kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 497ms
memory: 20152kb

input:

27 16

output:

OK

result:

ok "OK"