QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359262#5563. K.O. Kidscrsfaa#AC ✓1ms3864kbC++14581b2024-03-20 15:32:022024-03-20 15:32:02

Judging History

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

  • [2024-03-20 15:32:02]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3864kb
  • [2024-03-20 15:32:02]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
#define int long long
using Yukinoshita Yukino;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
char s[1005];
bool vis[1005];
signed main()
{
	int n=read(),k=read(),i,j,sum=0;
	scanf("%s",s+1);
	while(k--)
	{
		char ch='L';
		for(i=1;i<=n;i++,ch=ch=='L'?'R':'L')
		{
			if(vis[i]) ch=s[i];
			vis[i]=1;
			if(ch!=s[i]) break;
		}
		sum+=i>n;
	}
	cout<<sum;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

3 5
LRL

output:

5

result:

ok single line: '5'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

3 2
RRR

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

3 5
LLL

output:

3

result:

ok single line: '3'

Test #4:

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

input:

8 7
LLRLLLRR

output:

3

result:

ok single line: '3'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

5 1
LRLRL

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

5 1
LRLRR

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

5 5
LLRLL

output:

3

result:

ok single line: '3'

Test #8:

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

input:

10 10
LLRRLLRRRR

output:

4

result:

ok single line: '4'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

10 1
LLLLRRLRRL

output:

0

result:

ok single line: '0'

Test #10:

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

input:

10 20
LLRRLLLRLR

output:

16

result:

ok single line: '16'

Test #11:

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

input:

10 30
RRRLLLLRRL

output:

23

result:

ok single line: '23'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

10 5
LRRLLRLLRL

output:

2

result:

ok single line: '2'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

30 30
LRRLRLLLLRRRRRLLRLLLRLLRRLLLLR

output:

14

result:

ok single line: '14'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

30 50
RLRRRRRLRLLLRRRRRLLLRLLRRLLLLR

output:

32

result:

ok single line: '32'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

30 10
LLRRRRLLLRLRRRLRLLRLLLRRRLLRRR

output:

0

result:

ok single line: '0'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

30 500
RLLLRRRRRRLRRLRLRRLLRRLRLRRLLL

output:

485

result:

ok single line: '485'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

30 1000
RRLRLRRRLLLLLLRLRRRLLLLLRLLRLL

output:

983

result:

ok single line: '983'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

100 500
LRRRRLRRRRRRLLRRLLRLRLRLRLLRLRRRLRLLRLLRLLRLRLRLLRRRLRLRLRRRLLLRRRLLLLRRLRLLLRLLRLLRLRLRLRRLRLLLRLLL

output:

461

result:

ok single line: '461'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

100 1000
RLLLLRRRRRRLLRLLLLRLRLRLRRRLRLLRLLLLLLLLRRRLRRLRLRLLRRLRRLLRLLLLLRRRRLRRRRLLLRLLRRRRLLLRLLRLLRRLLRLR

output:

948

result:

ok single line: '948'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

100 10
LLLLRLLRLRLRLRLLRRRRLLRLRLRRRRRRLRRRRRRRLRRLRRLRRLLRLLRRLRRRRLLRLLLRLLRLRLRLLRLLLLLLRRLLLRRLLLRLLLRR

output:

0

result:

ok single line: '0'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

100 50
LLLLRRRLRRRLLLRLLLLRRRLLLLRRLRLRLRRRLLRLRLLRRRRLRRRRRRRLLLLRLRLRLLLLRLRRRRLRLRRRLLLLLLRLRRRRRLLLLLLL

output:

0

result:

ok single line: '0'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

100 200
LRLLLLLRRLRLRRLRLRRLLRLRLRLLRLLRRRLRRRRLLRLRLRLLRRRLLRRLLRLLLRRLLRLRLLRLRLLRRLLRLLRLRRRLLLRLRRRRRLLR

output:

160

result:

ok single line: '160'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

100 400
LRLRRLLLLRLLLLRLLRLLLLRRLLRLRLRLLRRRRRRRRLLRLRRRRLLLLRRLLLRRLRLRRLLLLLLLRRRRRRLLRLLRRRRRLRRRRRRLLRRL

output:

343

result:

ok single line: '343'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

100 150
LLLLRRRLRRLRRLLRRRLLRLRLLLRRLLLRLRLRRLRLLLLLLLRLLLLRRRLLLRLRLLLLRRRLLRLRLLRRRLLRLLLRLRLRLLRLRLRRRRRR

output:

102

result:

ok single line: '102'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

100 300
RLLRRLLLLRLRLRRRRRLLLRLLLLRLLRRRRLLLRLLLRLLLLLLRRLRLRLRLRLLLRLRLRRRRLLRRRRRLRLLRRRRLLLRRRRLLRRRLRRRL

output:

247

result:

ok single line: '247'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

100 700
LRLLLRLRRLRRLLLRRRRRRLRRRRLRLLLLLRLLRRLRRRLLLRLRLLLRRRLLRRRLLRRRRRLLLRRRRLRLLLLRRRRRLRLLLRRRRLRLLLRL

output:

645

result:

ok single line: '645'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

100 80
RLRLRLLLLRRLRRLLRRRRLRRRRRRLRLRRRRRRRLRRLLLRLLRRLRLRLRLLLRRRLRRRRLLLLRRLRRLRLRLLRLRLLRLLRLLRRLLRRLRR

output:

34

result:

ok single line: '34'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

500 500
LLLLRLLLRLLRRLLLLRRLLRLRLLRRRLRLRLRLLRRRRLRLRLRLLRLRLLRLLLLLLRLLRLRLLRLRRLRLRRRRRRLLRRLLLLLLRRRLRRRRLLRRRRLLLRLLLRLLLLLLRRLRRRLRLRRLLRRLRLLRLLRRRRRRRRRLRRLRLRLLRRLLRRRRLLRLLRLLLLLRRRLLRRLRRLLLRRRRLLRLLLRLLRRRLLRLRRRRLLLRLLRLLRLRLRLRLRLRRLLLLRLRRLRLRRLRRRLLRLLRLLLLRRLLLRRLRLRLRLLLLRLLRLLRLRRL...

output:

269

result:

ok single line: '269'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

500 100
LRRLLLLLRLRRRLLRRLLRLRLLLRRLLRRLLLRLLRLLRRRLRRRRRRRRLLLRLRRLRRLLRRRLRLRLLRLLLLLLRRLLLLRRLRLLLRRLLLRRRLLRLRRRRLRLLRRRRLRRLLRRLRLRLLRLRLRRLRLRRLRRRLLLLLRLRLLLLRLLLRRLLRRRLRLLLRLLLLLRRRLLLLRLLLRRLRRLRRRLRRRLLRLRRLRRLLLRLLLRLRRRRLLLLLRLRRLRRLLLRLLRLRLRLLLRRRRRRRLLLLRRRRLLLLRLRRLLLLRRRRRLRRRRRRLL...

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

500 1000
LLLLRRRLRRLRRRRRRLRRRLLLLLRRLRRLLRRRLLLRRLLRRRRRLLLRLRLLLRRRLRLRRRRRRRRLLRRRRRLLRLRRLRRRLLRRRLLLLLRRRLRLRLRLLLRRLLRLRRRLRLLLLLRRLRLRLLRRRLRLLRRRRLRLRLRLLRRRRRRRLLLLRRRRLRLLRLLRRLRLLLRRLRLLRRLLRRRRLLRRLLRLRLLRRRRLLLRRRRLLRRLLRRLLLLRLRLLLLRRLRRRRRLLLLLRLLRLRRLRLRLLRLRRRRRLLRRLLRRRLRLRRLRLRRLL...

output:

744

result:

ok single line: '744'

Test #31:

score: 0
Accepted
time: 1ms
memory: 3740kb

input:

500 800
LLRLRRRLRRLRLRRRLLRRLRLLRLRRRRRRLLRLLRRRRRRLRLRRRRLRRRLRLLLRRLRRRLRRLLLLRLRRLLLLLRRLRRRLRLLLLLRRLRRLLRRLRLRLLRRLLLLLRLLRLLRLRRLLLLLLRRRRLLRLRLRLRRRRRRLLRLLRLRRLLLRRLRRLLRRLLLLLRLLLLRRLRRRRLRRLLRLRRLLRLLRLRLLRLLRRLLRRLLLRRRLRRRRRRRRRRRRLLRRRRLLLLLLRRRRLLRRLRRLLLRLRRRRLLRLRLRRLLRRLRRLLLLLLRLRL...

output:

540

result:

ok single line: '540'

Test #32:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

500 200
LLLLRRRRLLRRLLRRRLRLLRLLRLRRLLRRRLRRRLLRLRLLLRRRLRRLLRLLLRRLRLLLLRLRLLLLLRLRRRRRLLLLLLLLLRRLLRRRLLRLLLRRLRRLRLRLLLRRRLRLLLRLLRRRLLLRLRLRRRRLLRLRLRRRLRLLRLLRRRRRLLLRLRRRRLRRLRLLRRLLRLRLRLRRRRRRLLLLLRLRLLRRRLLLRRLRLRLLRRLRRLRRLRRRLLLRLRLRLLRRRLRLLLLRRRLLRLRRLRLLLRLRRRRRLLRLLRRLRRLRRRRLLRRLLLRL...

output:

0

result:

ok single line: '0'

Test #33:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

1000 1000
LRLLRLLRLLRRRRRRRRRLLRRLRLRLRRLRRRLLLLLRLLRLRLRLLRLRRRRLLRRRLLLRRRLLRLRRLLLRLLLLRLLLRLRRLLRLRLLRLLRRLLRLRLRLLLRLLRLRRRLRRLRLLLRLLLRRRRLLRLLRLRLRRRRRLRRRLRRLRRLRLLLRRLLLRRRRRLLLRLRRLRRLLRRRLLLLLLLLRRRRLRRLRLRLRLLLLLRLLRRRRRRRRLRLLRRLRRRRRLRRLRRLRLRLRLLLLRLRRRLRRLRRLRRRLLLRLLLRLRRLRRLLLLLRRL...

output:

495

result:

ok single line: '495'

Test #34:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1000 500
LLRRLLLLRRRLRRLRRLRLRLRRLLLLRRRRLLRLRLLLRRRRRRLRRLRRLLLLLLLLLRRRLRRRLLRLRRLRRRRLLLRLRRRRRRLRLRRRLLLRLRRLRRLRLRRRRLLRLRLRRRRRLRRLLLLRRRRLLRRRLLRRRRLRLRLRLRLRLLLRLRRLLLLLLRLLLLRRRLRRRLLRLLRRLRLRLLLLLRLRLLRRRLRLRLRLRLLRRLRLLLRRRRRRRLRRRRLLRLLLLRLRLLRRRRRRLLRLRLLRLLRLLLLRRLRLLLRLRRRLRLLRLRRRRLL...

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

1000 300
LLLLLLLLLLLLRLLLLLRRRRLRLLRRLLRLLLRLRLRRRRRRLLLLRLLLLLRLRLRRLRLLRRLLRRLRLRRRRRRRLRLRLLLLLRRLLRRRLLLLLRLLRRLLRLRLRRLRLLLLRLLLLLLRLRLLLLLLLLLRLRLLLRLLLLRRLRLRRLRRRRRRRLLLLLLLRRRLRRLRLRLLLLRLLLRLRRRLLLRRRRRRLRRLRLRLLLRRLLRRRLLRLLRLLLLLRLRRLLRLRLLRRLLRRRLLLLRLLLRRRLLLLLLRLLRLLLRRRRLRLLLLLLLRRLL...

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

1000 100
RRLRRLLLRRLRLRLLRRRRRRRLLRLRRLLLLLLRLRLRLLRLLLRRLRLLRRRRRRLLRLRRLLRRLLRLRLRRLRLLRLRRRRRLRLRRRRLLLLRRLLRRLLRLLLRRRRRRLLRLRLRRRLLLRRRLRRRLLRRRRLRRRLRRLLRLRLRLRRRRRLRLLLRLRRLLLRLLRRLRRRRLRRLLLLRLLLRLLRRRRLLRRRLLRRRLRRLRRRLLLLRRRLLLLLLRRLLLRRRRRLRRLLRLRRRLRRLLLRRRRLRLRLLLLRRRLLRRLRLRLLRRRRLRLLL...

output:

0

result:

ok single line: '0'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1000 10
LLLRRRLLRRRLRLLLLRLLRRLLLRRLLRLLRRRRRLLRRLLLLRLLLLRLLRRLLRRRLLRRRRLLLRLLRLLLRRRRLLLRLRRRLLLRRLRRLLRLRLLLLLLLLLLRLRRRLLLLLRLRLLLLRLLLRRLLRLRRLLRRRRLRLRLRRRLLRLRLRRRRLLRRLRLRRRLRLLLLLLRRRLLLLRLRLLLRRLLLRLLLLRRRLRRLRRLLRRRRLRRLLRLLRRRRRRLRRRLRLLRLRLRLLLRLRLRLRLRLLRLLRRLRLRLLLLRRRRLRLLLLLRLRLLRL...

output:

0

result:

ok single line: '0'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3856kb

input:

1000 1000
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

999

result:

ok single line: '999'

Test #39:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

1000 1000
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

1000

result:

ok single line: '1000'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1000 250
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

249

result:

ok single line: '249'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

1000 250
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

250

result:

ok single line: '250'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

1000 50
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

49

result:

ok single line: '49'

Test #43:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

1000 50
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

50

result:

ok single line: '50'

Test #44:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

1000 250
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1000 50
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:

0

result:

ok single line: '0'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1000 50
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'