QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394368#4913. 子集匹配oscaryang100 ✓537ms20376kbC++17236b2024-04-20 13:53:542024-04-20 13:53:54

Judging History

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

  • [2024-04-20 13:53:54]
  • 评测
  • 测评结果:100
  • 用时:537ms
  • 内存:20376kb
  • [2024-04-20 13:53:54]
  • 提交

answer

#include "hall.h"
int solve (int n, int k, int s) {
	int cnt = 0, pos = -1, mn = n + 1;
	for (int i = 0; i < n; i ++) {
		if (cnt <= mn) mn = cnt, pos = i;
		if ((s >> i) & 1) ++ cnt;
		else -- cnt;
	}
	return s ^ (1 << pos);
}

详细

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

score: 5
Accepted
time: 23ms
memory: 4472kb

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

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

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 47ms
memory: 4956kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 25ms
memory: 4672kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 106ms
memory: 5708kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 239ms
memory: 7720kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 194ms
memory: 7856kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 141ms
memory: 7792kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

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

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 537ms
memory: 20376kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

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

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

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

input:

27 16

output:

OK

result:

ok "OK"