QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394283#4913. 子集匹配luanmenglei100 ✓699ms20356kbC++17322b2024-04-20 10:49:142024-04-20 10:49:14

Judging History

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

  • [2024-04-20 10:49:14]
  • 评测
  • 测评结果:100
  • 用时:699ms
  • 内存:20356kb
  • [2024-04-20 10:49:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// #include "hall.h"

int solve(int n, int k, int S) {
	int cnt = 0, suf = 0, pos = n;
	for (int i = n - 1; i >= 1; i --) {
		if (S >> i & 1)
			cnt += 1;
		else
			cnt -= 1;
		if (cnt <= suf) {
			suf = cnt;
			pos = i;
		}
	}
	return S ^ (1 << (pos - 1));
}

详细

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

score: 5
Accepted
time: 5ms
memory: 3740kb

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

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

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 80ms
memory: 4772kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 57ms
memory: 4820kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 40ms
memory: 4700kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

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

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 331ms
memory: 7624kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 250ms
memory: 7900kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 176ms
memory: 7828kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 626ms
memory: 11836kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 699ms
memory: 20356kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

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

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

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

input:

27 16

output:

OK

result:

ok "OK"