QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394235#4913. 子集匹配lfxxx100 ✓702ms20148kbC++17227b2024-04-20 10:29:082024-04-20 10:29:12

Judging History

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

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

answer

#include"hall.h"
int solve(int n,int K,int s)
{
	int id = n, sum = 0, mn = 0;
	for (int i = n - 1; i >= 0; --i) {
		sum += (((s >> i) & 1) ? 1 : -1);
		if (sum <= mn) mn = sum, id = i;
	}
	return s ^ (1 << (id - 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: 3636kb

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 38ms
memory: 4496kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 83ms
memory: 4852kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

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

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

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

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 149ms
memory: 5960kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 330ms
memory: 7864kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 264ms
memory: 8052kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

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

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 608ms
memory: 11948kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 702ms
memory: 20012kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 659ms
memory: 20144kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

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

input:

27 16

output:

OK

result:

ok "OK"