QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742898#8975. Eva and Euro coinspanelopeAC ✓17ms10656kbC++14738b2024-11-13 17:36:052024-11-13 17:36:07

Judging History

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

  • [2024-11-13 17:36:07]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:10656kb
  • [2024-11-13 17:36:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
 
#define N 1000010
char s[N], t[N], sta[N];
int cnt[N], top;
int n, k;
 
void work(char *s) {
	memset(cnt, 0, sizeof cnt);
	top = 0; 
	for (int i = 1; i <= n; ++i) {
		if (top == 0) {
			sta[++top] = s[i];
			cnt[top] = 1;
		} else {
			if (sta[top] == s[i]) {
				cnt[top + 1] = cnt[top] + 1;
			} else {
				cnt[top + 1] = 1;
			}
			sta[++top] = s[i]; 
		}
		if (cnt[top] == k) {
			top -= k; 
		}
	}
	for (int i = 1; i <= top; ++i) {
		s[i] = sta[i]; 
	}
	s[top + 1] = 0;
}
 
int main() {
	while (scanf("%d%d", &n, &k) != EOF) {
		scanf("%s%s", s + 1, t + 1);
		work(s); work(t);
		puts(strcmp(s + 1, t + 1) == 0 ? "Yes" : "No");
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6 2
000000
101101

output:

Yes

result:

ok single line: 'Yes'

Test #2:

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

input:

8 3
10101010
01010101

output:

No

result:

ok single line: 'No'

Test #3:

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

input:

10 3
0100011001
0001000000

output:

Yes

result:

ok single line: 'Yes'

Test #4:

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

input:

10 3
0100001010
0000000000

output:

No

result:

ok single line: 'No'

Test #5:

score: 0
Accepted
time: 7ms
memory: 10496kb

input:

1000000 1
01010010001111000111010001001110100010010111101011100110111000101111100001111111000000001001110011101110001011110000011011101001010001111000001111110001010101011110010010100000001001100001100111111100101001101110100000001011111011011101000011111110100100000001001001110011011011000100111010...

output:

Yes

result:

ok single line: 'Yes'

Test #6:

score: 0
Accepted
time: 12ms
memory: 10476kb

input:

1000000 2
11000001010001101110110010110111011001000110110111100010011111100111111011010000000100001001010010000001110000011001101110000001010101001001111010100010110110010001000011001010000101010011111011000011000000110101111100110100101101101110110010100100011110011100001101000010011011101000000010...

output:

No

result:

ok single line: 'No'

Test #7:

score: 0
Accepted
time: 10ms
memory: 10652kb

input:

1000000 3
00000011100011100000000000000000111000000000000111001110000001110000000001110000001110000000000000000111000000000111011100000000000000000000011101111110000001110000000000000011100000000011100000000000000000000000000011100000000000111100011100000100000000111000111000000000000100000011100000...

output:

Yes

result:

ok single line: 'Yes'

Test #8:

score: 0
Accepted
time: 10ms
memory: 10460kb

input:

1000000 4
10000110000000010000110000111111111000010000111100001111111111111111111100001111111000011111111111111110000111000011111110000111111111111111111100001111111111110000111111111111111111000011111111111100001111111100000000111111111111111111111111100001110110000111111111111111111100001111100001...

output:

Yes

result:

ok single line: 'Yes'

Test #9:

score: 0
Accepted
time: 10ms
memory: 10584kb

input:

1000000 10
0000100000001111111111000000111111111100000001000001000000011111111110011111111110000000000000000011111111110000010000000000111111111011111111110000000011111111110000001111100000000001111100000001111111111000001111111111001111111111001111111111000001111111110000000000100000000000000000001...

output:

Yes

result:

ok single line: 'Yes'

Test #10:

score: 0
Accepted
time: 10ms
memory: 10504kb

input:

1000000 20
1000000000000000000001111111111100000000000000000000011111111110100000000000000000000111000000000000000000001111111100000000000000001111111111111111111100001111111111111111111111111111111111111011111111111111011111111111111111111111100000000111111111111111111110000000000001111110000000000...

output:

Yes

result:

ok single line: 'Yes'

Test #11:

score: 0
Accepted
time: 9ms
memory: 10456kb

input:

1000000 100
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: 0
Accepted
time: 6ms
memory: 10656kb

input:

1000000 200
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #13:

score: 0
Accepted
time: 13ms
memory: 10628kb

input:

1000000 1000000
00101011010001000010010000111101010101101011111101110111110011011110001001011010011100101111011110011011010110000010110101100100111001110110101101010011111101010111011010110000110110110101100010011100101111001101110010011000111011011110111000010011010101000100101011110110011010111011...

output:

No

result:

ok single line: 'No'

Test #14:

score: 0
Accepted
time: 17ms
memory: 10568kb

input:

1000000 999999
010101111111011011110000110100111101111011000110101100001101110010110100101000111111111001011001001111101101110111010001110010101010101110001110000001010110010110111000110101001100000110111111110000010111011110110110110010100101100010010100110111101111001101110111101000101101111000111...

output:

No

result:

ok single line: 'No'

Test #15:

score: 0
Accepted
time: 10ms
memory: 10472kb

input:

1000000 3
00000011100011100000000000000000111000000000000111001110000001110000000001110000001110000000000000000111000000000111011100000000000000000000011101111110000001110000000000000011100000000011100000000000000000000000000011100000000000111100011100000100000000111000111000000000000100000011100000...

output:

No

result:

ok single line: 'No'

Test #16:

score: 0
Accepted
time: 7ms
memory: 10564kb

input:

1000000 4
10000110000000010000110000111111111000010000111100001111111111111111111100001111111000011111111111111110000111000011111110000111111111111111111100001111111111110000111111111111111111000011111111111100001111111100000000111111111111111111111111100001110110000111111111111111111100001111100001...

output:

No

result:

ok single line: 'No'

Test #17:

score: 0
Accepted
time: 7ms
memory: 10504kb

input:

1000000 10
0000100000001111111111000000111111111100000001000001000000011111111110011111111110000000000000000011111111110000010000000000111111111011111111110000000011111111110000001111100000000001111100000001111111111000001111111111001111111111001111111111000001111111110000000000100000000000000000001...

output:

No

result:

ok single line: 'No'

Test #18:

score: 0
Accepted
time: 9ms
memory: 10656kb

input:

1000000 20
1000000000000000000001111111111100000000000000000000011111111110100000000000000000000111000000000000000000001111111100000000000000001111111111111111111100001111111111111111111111111111111111111011111111111111011111111111111111111111100000000111111111111111111110000000000001111110000000000...

output:

No

result:

ok single line: 'No'

Test #19:

score: 0
Accepted
time: 6ms
memory: 10440kb

input:

1000000 100
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111...

output:

No

result:

ok single line: 'No'

Test #20:

score: 0
Accepted
time: 9ms
memory: 10652kb

input:

1000000 200
000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111111...

output:

No

result:

ok single line: 'No'

Test #21:

score: 0
Accepted
time: 10ms
memory: 10640kb

input:

1000000 1000000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #22:

score: 0
Accepted
time: 7ms
memory: 10636kb

input:

1000000 999999
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

No

result:

ok single line: 'No'

Extra Test:

score: 0
Extra Test Passed