QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#394270#4913. 子集匹配Lucky_Xiang100 ✓540ms20368kbC++14236b2024-04-20 10:40:542024-04-20 10:40:55

Judging History

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

  • [2024-04-20 10:40:55]
  • 评测
  • 测评结果:100
  • 用时:540ms
  • 内存:20368kb
  • [2024-04-20 10:40:54]
  • 提交

answer

#include<bits/stdc++.h>
#include"hall.h"
using namespace std;
int solve(int n,int K,int S)
{
	int pos=-1, mi=0, cur=0;
	for(int i=0;i<n;i++)
	{
		cur+=((S>>i)&1)?1:-1;
		if(cur<=mi)pos=i, mi=cur;
	}
	return S^(1<<(pos+1));
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

14 8

output:

OK

result:

ok "OK"

Test #2:

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

input:

15 8

output:

OK

result:

ok "OK"

Test #3:

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

input:

15 9

output:

OK

result:

ok "OK"

Test #4:

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

input:

15 10

output:

OK

result:

ok "OK"

Test #5:

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

input:

18 10

output:

OK

result:

ok "OK"

Test #6:

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

input:

19 10

output:

OK

result:

ok "OK"

Test #7:

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

input:

19 11

output:

OK

result:

ok "OK"

Test #8:

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

input:

19 12

output:

OK

result:

ok "OK"

Test #9:

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

input:

22 12

output:

OK

result:

ok "OK"

Test #10:

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

input:

23 12

output:

OK

result:

ok "OK"

Test #11:

score: 5
Accepted
time: 48ms
memory: 4688kb

input:

23 13

output:

OK

result:

ok "OK"

Test #12:

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

input:

23 14

output:

OK

result:

ok "OK"

Test #13:

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

input:

24 13

output:

OK

result:

ok "OK"

Test #14:

score: 5
Accepted
time: 248ms
memory: 7772kb

input:

25 13

output:

OK

result:

ok "OK"

Test #15:

score: 5
Accepted
time: 197ms
memory: 8084kb

input:

25 14

output:

OK

result:

ok "OK"

Test #16:

score: 5
Accepted
time: 140ms
memory: 7844kb

input:

25 15

output:

OK

result:

ok "OK"

Test #17:

score: 5
Accepted
time: 479ms
memory: 12140kb

input:

26 14

output:

OK

result:

ok "OK"

Test #18:

score: 5
Accepted
time: 540ms
memory: 20008kb

input:

27 14

output:

OK

result:

ok "OK"

Test #19:

score: 5
Accepted
time: 507ms
memory: 20084kb

input:

27 15

output:

OK

result:

ok "OK"

Test #20:

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

input:

27 16

output:

OK

result:

ok "OK"