QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394397#4913. 子集匹配biuld100 ✓942ms20320kbC++14548b2024-04-20 14:18:252024-04-20 14:18:27

Judging History

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

  • [2024-04-20 14:18:27]
  • 评测
  • 测评结果:100
  • 用时:942ms
  • 内存:20320kb
  • [2024-04-20 14:18:25]
  • 提交

answer

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

int solve(int n, int k, int S){
	int mn = 0, p = 0, now = 0;
	for(int i = 1; i <= n; ++ i){
		if((S >> (n - i)) & 1){
			now ++;
		}
		else{
			now --;
		}
		if(now <= mn){
			mn = now;
			p = i;
		}
	}
	// int ans = 0;
	// for(int i = 1; i <= n; ++ i){
	// 	if(i - 1 == p){
	// 		// ans += (1 << (n - i));
	// 		continue;
	// 	}
	// 	else if((S >> (n - i) & 1)){
	// 		ans += (1 << (n - i));
	// 	}
	// }
	// return ans;
	return S ^ (1 << (n - p - 1));
}

详细

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

score: 5
Accepted
time: 6ms
memory: 3820kb

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

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

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

score: 5
Accepted
time: 84ms
memory: 4696kb

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

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

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

score: 5
Accepted
time: 44ms
memory: 4756kb

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

score: 5
Accepted
time: 164ms
memory: 5712kb

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 349ms
memory: 8056kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 270ms
memory: 8064kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

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

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 701ms
memory: 12172kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 942ms
memory: 20312kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 831ms
memory: 20320kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

score: 5
Accepted
time: 770ms
memory: 20176kb

input:

27 16

output:

OK

result:

ok "OK"