QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#373730#5563. K.O. Kidskevinyang#AC ✓1ms3828kbC++17434b2024-04-02 02:31:412024-04-02 02:31:43

Judging History

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

  • [2024-04-02 02:31:43]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3828kb
  • [2024-04-02 02:31:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	int i = 0;
	while(k && i<n){
		char pre = 'R';
		if(i>0){
			pre = s[i-1];
		}
		while(i<n && s[i]!=pre){
			pre = s[i];
			i++;
		}
		if(i==n){
			break;
		}
		i++;
		k--;
		//cout << i << '\n';
	}
	cout << k << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3756kb

input:

3 5
LRL

output:

5

result:

ok single line: '5'

Test #2:

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

input:

3 2
RRR

output:

0

result:

ok single line: '0'

Test #3:

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

input:

3 5
LLL

output:

3

result:

ok single line: '3'

Test #4:

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

input:

8 7
LLRLLLRR

output:

3

result:

ok single line: '3'

Test #5:

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

input:

5 1
LRLRL

output:

1

result:

ok single line: '1'

Test #6:

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

input:

5 1
LRLRR

output:

0

result:

ok single line: '0'

Test #7:

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

input:

5 5
LLRLL

output:

3

result:

ok single line: '3'

Test #8:

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

input:

10 10
LLRRLLRRRR

output:

4

result:

ok single line: '4'

Test #9:

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

input:

10 1
LLLLRRLRRL

output:

0

result:

ok single line: '0'

Test #10:

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

input:

10 20
LLRRLLLRLR

output:

16

result:

ok single line: '16'

Test #11:

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

input:

10 30
RRRLLLLRRL

output:

23

result:

ok single line: '23'

Test #12:

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

input:

10 5
LRRLLRLLRL

output:

2

result:

ok single line: '2'

Test #13:

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

input:

30 30
LRRLRLLLLRRRRRLLRLLLRLLRRLLLLR

output:

14

result:

ok single line: '14'

Test #14:

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

input:

30 50
RLRRRRRLRLLLRRRRRLLLRLLRRLLLLR

output:

32

result:

ok single line: '32'

Test #15:

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

input:

30 10
LLRRRRLLLRLRRRLRLLRLLLRRRLLRRR

output:

0

result:

ok single line: '0'

Test #16:

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

input:

30 500
RLLLRRRRRRLRRLRLRRLLRRLRLRRLLL

output:

485

result:

ok single line: '485'

Test #17:

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

input:

30 1000
RRLRLRRRLLLLLLRLRRRLLLLLRLLRLL

output:

983

result:

ok single line: '983'

Test #18:

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

input:

100 500
LRRRRLRRRRRRLLRRLLRLRLRLRLLRLRRRLRLLRLLRLLRLRLRLLRRRLRLRLRRRLLLRRRLLLLRRLRLLLRLLRLLRLRLRLRRLRLLLRLLL

output:

461

result:

ok single line: '461'

Test #19:

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

input:

100 1000
RLLLLRRRRRRLLRLLLLRLRLRLRRRLRLLRLLLLLLLLRRRLRRLRLRLLRRLRRLLRLLLLLRRRRLRRRRLLLRLLRRRRLLLRLLRLLRRLLRLR

output:

948

result:

ok single line: '948'

Test #20:

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

input:

100 10
LLLLRLLRLRLRLRLLRRRRLLRLRLRRRRRRLRRRRRRRLRRLRRLRRLLRLLRRLRRRRLLRLLLRLLRLRLRLLRLLLLLLRRLLLRRLLLRLLLRR

output:

0

result:

ok single line: '0'

Test #21:

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

input:

100 50
LLLLRRRLRRRLLLRLLLLRRRLLLLRRLRLRLRRRLLRLRLLRRRRLRRRRRRRLLLLRLRLRLLLLRLRRRRLRLRRRLLLLLLRLRRRRRLLLLLLL

output:

0

result:

ok single line: '0'

Test #22:

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

input:

100 200
LRLLLLLRRLRLRRLRLRRLLRLRLRLLRLLRRRLRRRRLLRLRLRLLRRRLLRRLLRLLLRRLLRLRLLRLRLLRRLLRLLRLRRRLLLRLRRRRRLLR

output:

160

result:

ok single line: '160'

Test #23:

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

input:

100 400
LRLRRLLLLRLLLLRLLRLLLLRRLLRLRLRLLRRRRRRRRLLRLRRRRLLLLRRLLLRRLRLRRLLLLLLLRRRRRRLLRLLRRRRRLRRRRRRLLRRL

output:

343

result:

ok single line: '343'

Test #24:

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

input:

100 150
LLLLRRRLRRLRRLLRRRLLRLRLLLRRLLLRLRLRRLRLLLLLLLRLLLLRRRLLLRLRLLLLRRRLLRLRLLRRRLLRLLLRLRLRLLRLRLRRRRRR

output:

102

result:

ok single line: '102'

Test #25:

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

input:

100 300
RLLRRLLLLRLRLRRRRRLLLRLLLLRLLRRRRLLLRLLLRLLLLLLRRLRLRLRLRLLLRLRLRRRRLLRRRRRLRLLRRRRLLLRRRRLLRRRLRRRL

output:

247

result:

ok single line: '247'

Test #26:

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

input:

100 700
LRLLLRLRRLRRLLLRRRRRRLRRRRLRLLLLLRLLRRLRRRLLLRLRLLLRRRLLRRRLLRRRRRLLLRRRRLRLLLLRRRRRLRLLLRRRRLRLLLRL

output:

645

result:

ok single line: '645'

Test #27:

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

input:

100 80
RLRLRLLLLRRLRRLLRRRRLRRRRRRLRLRRRRRRRLRRLLLRLLRRLRLRLRLLLRRRLRRRRLLLLRRLRRLRLRLLRLRLLRLLRLLRRLLRRLRR

output:

34

result:

ok single line: '34'

Test #28:

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

input:

500 500
LLLLRLLLRLLRRLLLLRRLLRLRLLRRRLRLRLRLLRRRRLRLRLRLLRLRLLRLLLLLLRLLRLRLLRLRRLRLRRRRRRLLRRLLLLLLRRRLRRRRLLRRRRLLLRLLLRLLLLLLRRLRRRLRLRRLLRRLRLLRLLRRRRRRRRRLRRLRLRLLRRLLRRRRLLRLLRLLLLLRRRLLRRLRRLLLRRRRLLRLLLRLLRRRLLRLRRRRLLLRLLRLLRLRLRLRLRLRRLLLLRLRRLRLRRLRRRLLRLLRLLLLRRLLLRRLRLRLRLLLLRLLRLLRLRRL...

output:

269

result:

ok single line: '269'

Test #29:

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

input:

500 100
LRRLLLLLRLRRRLLRRLLRLRLLLRRLLRRLLLRLLRLLRRRLRRRRRRRRLLLRLRRLRRLLRRRLRLRLLRLLLLLLRRLLLLRRLRLLLRRLLLRRRLLRLRRRRLRLLRRRRLRRLLRRLRLRLLRLRLRRLRLRRLRRRLLLLLRLRLLLLRLLLRRLLRRRLRLLLRLLLLLRRRLLLLRLLLRRLRRLRRRLRRRLLRLRRLRRLLLRLLLRLRRRRLLLLLRLRRLRRLLLRLLRLRLRLLLRRRRRRRLLLLRRRRLLLLRLRRLLLLRRRRRLRRRRRRLL...

output:

0

result:

ok single line: '0'

Test #30:

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

input:

500 1000
LLLLRRRLRRLRRRRRRLRRRLLLLLRRLRRLLRRRLLLRRLLRRRRRLLLRLRLLLRRRLRLRRRRRRRRLLRRRRRLLRLRRLRRRLLRRRLLLLLRRRLRLRLRLLLRRLLRLRRRLRLLLLLRRLRLRLLRRRLRLLRRRRLRLRLRLLRRRRRRRLLLLRRRRLRLLRLLRRLRLLLRRLRLLRRLLRRRRLLRRLLRLRLLRRRRLLLRRRRLLRRLLRRLLLLRLRLLLLRRLRRRRRLLLLLRLLRLRRLRLRLLRLRRRRRLLRRLLRRRLRLRRLRLRRLL...

output:

744

result:

ok single line: '744'

Test #31:

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

input:

500 800
LLRLRRRLRRLRLRRRLLRRLRLLRLRRRRRRLLRLLRRRRRRLRLRRRRLRRRLRLLLRRLRRRLRRLLLLRLRRLLLLLRRLRRRLRLLLLLRRLRRLLRRLRLRLLRRLLLLLRLLRLLRLRRLLLLLLRRRRLLRLRLRLRRRRRRLLRLLRLRRLLLRRLRRLLRRLLLLLRLLLLRRLRRRRLRRLLRLRRLLRLLRLRLLRLLRRLLRRLLLRRRLRRRRRRRRRRRRLLRRRRLLLLLLRRRRLLRRLRRLLLRLRRRRLLRLRLRRLLRRLRRLLLLLLRLRL...

output:

540

result:

ok single line: '540'

Test #32:

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

input:

500 200
LLLLRRRRLLRRLLRRRLRLLRLLRLRRLLRRRLRRRLLRLRLLLRRRLRRLLRLLLRRLRLLLLRLRLLLLLRLRRRRRLLLLLLLLLRRLLRRRLLRLLLRRLRRLRLRLLLRRRLRLLLRLLRRRLLLRLRLRRRRLLRLRLRRRLRLLRLLRRRRRLLLRLRRRRLRRLRLLRRLLRLRLRLRRRRRRLLLLLRLRLLRRRLLLRRLRLRLLRRLRRLRRLRRRLLLRLRLRLLRRRLRLLLLRRRLLRLRRLRLLLRLRRRRRLLRLLRRLRRLRRRRLLRRLLLRL...

output:

0

result:

ok single line: '0'

Test #33:

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

input:

1000 1000
LRLLRLLRLLRRRRRRRRRLLRRLRLRLRRLRRRLLLLLRLLRLRLRLLRLRRRRLLRRRLLLRRRLLRLRRLLLRLLLLRLLLRLRRLLRLRLLRLLRRLLRLRLRLLLRLLRLRRRLRRLRLLLRLLLRRRRLLRLLRLRLRRRRRLRRRLRRLRRLRLLLRRLLLRRRRRLLLRLRRLRRLLRRRLLLLLLLLRRRRLRRLRLRLRLLLLLRLLRRRRRRRRLRLLRRLRRRRRLRRLRRLRLRLRLLLLRLRRRLRRLRRLRRRLLLRLLLRLRRLRRLLLLLRRL...

output:

495

result:

ok single line: '495'

Test #34:

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

input:

1000 500
LLRRLLLLRRRLRRLRRLRLRLRRLLLLRRRRLLRLRLLLRRRRRRLRRLRRLLLLLLLLLRRRLRRRLLRLRRLRRRRLLLRLRRRRRRLRLRRRLLLRLRRLRRLRLRRRRLLRLRLRRRRRLRRLLLLRRRRLLRRRLLRRRRLRLRLRLRLRLLLRLRRLLLLLLRLLLLRRRLRRRLLRLLRRLRLRLLLLLRLRLLRRRLRLRLRLRLLRRLRLLLRRRRRRRLRRRRLLRLLLLRLRLLRRRRRRLLRLRLLRLLRLLLLRRLRLLLRLRRRLRLLRLRRRRLL...

output:

0

result:

ok single line: '0'

Test #35:

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

input:

1000 300
LLLLLLLLLLLLRLLLLLRRRRLRLLRRLLRLLLRLRLRRRRRRLLLLRLLLLLRLRLRRLRLLRRLLRRLRLRRRRRRRLRLRLLLLLRRLLRRRLLLLLRLLRRLLRLRLRRLRLLLLRLLLLLLRLRLLLLLLLLLRLRLLLRLLLLRRLRLRRLRRRRRRRLLLLLLLRRRLRRLRLRLLLLRLLLRLRRRLLLRRRRRRLRRLRLRLLLRRLLRRRLLRLLRLLLLLRLRRLLRLRLLRRLLRRRLLLLRLLLRRRLLLLLLRLLRLLLRRRRLRLLLLLLLRRLL...

output:

0

result:

ok single line: '0'

Test #36:

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

input:

1000 100
RRLRRLLLRRLRLRLLRRRRRRRLLRLRRLLLLLLRLRLRLLRLLLRRLRLLRRRRRRLLRLRRLLRRLLRLRLRRLRLLRLRRRRRLRLRRRRLLLLRRLLRRLLRLLLRRRRRRLLRLRLRRRLLLRRRLRRRLLRRRRLRRRLRRLLRLRLRLRRRRRLRLLLRLRRLLLRLLRRLRRRRLRRLLLLRLLLRLLRRRRLLRRRLLRRRLRRLRRRLLLLRRRLLLLLLRRLLLRRRRRLRRLLRLRRRLRRLLLRRRRLRLRLLLLRRRLLRRLRLRLLRRRRLRLLL...

output:

0

result:

ok single line: '0'

Test #37:

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

input:

1000 10
LLLRRRLLRRRLRLLLLRLLRRLLLRRLLRLLRRRRRLLRRLLLLRLLLLRLLRRLLRRRLLRRRRLLLRLLRLLLRRRRLLLRLRRRLLLRRLRRLLRLRLLLLLLLLLLRLRRRLLLLLRLRLLLLRLLLRRLLRLRRLLRRRRLRLRLRRRLLRLRLRRRRLLRRLRLRRRLRLLLLLLRRRLLLLRLRLLLRRLLLRLLLLRRRLRRLRRLLRRRRLRRLLRLLRRRRRRLRRRLRLLRLRLRLLLRLRLRLRLRLLRLLRRLRLRLLLLRRRRLRLLLLLRLRLLRL...

output:

0

result:

ok single line: '0'

Test #38:

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

input:

1000 1000
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

999

result:

ok single line: '999'

Test #39:

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

input:

1000 1000
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

1000

result:

ok single line: '1000'

Test #40:

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

input:

1000 250
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

249

result:

ok single line: '249'

Test #41:

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

input:

1000 250
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

250

result:

ok single line: '250'

Test #42:

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

input:

1000 50
RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

49

result:

ok single line: '49'

Test #43:

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

input:

1000 50
LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

50

result:

ok single line: '50'

Test #44:

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

input:

1000 250
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'

Test #45:

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

input:

1000 50
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:

0

result:

ok single line: '0'

Test #46:

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

input:

1000 50
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

output:

0

result:

ok single line: '0'