QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394594#4913. 子集匹配le0n100 ✓583ms20152kbC++14231b2024-04-20 16:34:482024-04-20 16:34:48

Judging History

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

  • [2024-04-20 16:34:48]
  • 评测
  • 测评结果:100
  • 用时:583ms
  • 内存:20152kb
  • [2024-04-20 16:34:48]
  • 提交

answer

#include "hall.h"

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

详细

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

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: 4048kb

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 27ms
memory: 4116kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 56ms
memory: 5016kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

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

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

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

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 107ms
memory: 5672kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 236ms
memory: 7916kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 187ms
memory: 7804kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 138ms
memory: 7872kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 458ms
memory: 12176kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

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

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 501ms
memory: 20072kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 495ms
memory: 20036kb

input:

27 16

output:

OK

result:

ok "OK"