QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#822327#8975. Eva and Euro coinsKazemaruAC ✓21ms14228kbC++14514b2024-12-20 10:11:402024-12-20 10:11:40

Judging History

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

  • [2024-12-20 10:11:40]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:14228kb
  • [2024-12-20 10:11:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,j,k) for(int i=j;i<=k;++i)
#define g(i,j,k) for(int i=j;i>=k;--i)
int n,m,s,l;
const int N=2e6;
int a[N];char c[N];
string gt(){
	string o="";
	scanf("%s",c+1);
	a[m=0]=1;
	f(i,1,n)if((c[i]^c[i-1])&1){
		l=(i-a[m])%s+a[m];
		if(m&&a[m]==l)--m;
		else a[++m]=l;
	}
	f(i,1,n)c[i]='0';
	f(i,1,m)c[a[i]]='1';
	f(i,1,n)o+=c[i];
	return o;
}
signed main(){
	cin>>n>>s;++n;
	puts(gt()==gt()?"Yes":"No");
	return 0;
}

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

詳細信息

Test #1:

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

input:

6 2
000000
101101

output:

Yes

result:

ok single line: 'Yes'

Test #2:

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

input:

8 3
10101010
01010101

output:

No

result:

ok single line: 'No'

Test #3:

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

input:

10 3
0100011001
0001000000

output:

Yes

result:

ok single line: 'Yes'

Test #4:

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

input:

10 3
0100001010
0000000000

output:

No

result:

ok single line: 'No'

Test #5:

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

input:

1000000 1
01010010001111000111010001001110100010010111101011100110111000101111100001111111000000001001110011101110001011110000011011101001010001111000001111110001010101011110010010100000001001100001100111111100101001101110100000001011111011011101000011111110100100000001001001110011011011000100111010...

output:

Yes

result:

ok single line: 'Yes'

Test #6:

score: 0
Accepted
time: 20ms
memory: 9548kb

input:

1000000 2
11000001010001101110110010110111011001000110110111100010011111100111111011010000000100001001010010000001110000011001101110000001010101001001111010100010110110010001000011001010000101010011111011000011000000110101111100110100101101101110110010100100011110011100001101000010011011101000000010...

output:

No

result:

ok single line: 'No'

Test #7:

score: 0
Accepted
time: 16ms
memory: 10204kb

input:

1000000 3
00000011100011100000000000000000111000000000000111001110000001110000000001110000001110000000000000000111000000000111011100000000000000000000011101111110000001110000000000000011100000000011100000000000000000000000000011100000000000111100011100000100000000111000111000000000000100000011100000...

output:

Yes

result:

ok single line: 'Yes'

Test #8:

score: 0
Accepted
time: 8ms
memory: 10144kb

input:

1000000 4
10000110000000010000110000111111111000010000111100001111111111111111111100001111111000011111111111111110000111000011111110000111111111111111111100001111111111110000111111111111111111000011111111111100001111111100000000111111111111111111111111100001110110000111111111111111111100001111100001...

output:

Yes

result:

ok single line: 'Yes'

Test #9:

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

input:

1000000 10
0000100000001111111111000000111111111100000001000001000000011111111110011111111110000000000000000011111111110000010000000000111111111011111111110000000011111111110000001111100000000001111100000001111111111000001111111111001111111111001111111111000001111111110000000000100000000000000000001...

output:

Yes

result:

ok single line: 'Yes'

Test #10:

score: 0
Accepted
time: 14ms
memory: 9528kb

input:

1000000 20
1000000000000000000001111111111100000000000000000000011111111110100000000000000000000111000000000000000000001111111100000000000000001111111111111111111100001111111111111111111111111111111111111011111111111111011111111111111111111111100000000111111111111111111110000000000001111110000000000...

output:

Yes

result:

ok single line: 'Yes'

Test #11:

score: 0
Accepted
time: 4ms
memory: 10052kb

input:

1000000 100
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #12:

score: 0
Accepted
time: 4ms
memory: 9864kb

input:

1000000 200
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #13:

score: 0
Accepted
time: 15ms
memory: 14228kb

input:

1000000 1000000
00101011010001000010010000111101010101101011111101110111110011011110001001011010011100101111011110011011010110000010110101100100111001110110101101010011111101010111011010110000110110110101100010011100101111001101110010011000111011011110111000010011010101000100101011110110011010111011...

output:

No

result:

ok single line: 'No'

Test #14:

score: 0
Accepted
time: 21ms
memory: 12264kb

input:

1000000 999999
010101111111011011110000110100111101111011000110101100001101110010110100101000111111111001011001001111101101110111010001110010101010101110001110000001010110010110111000110101001100000110111111110000010111011110110110110010100101100010010100110111101111001101110111101000101101111000111...

output:

No

result:

ok single line: 'No'

Test #15:

score: 0
Accepted
time: 16ms
memory: 9620kb

input:

1000000 3
00000011100011100000000000000000111000000000000111001110000001110000000001110000001110000000000000000111000000000111011100000000000000000000011101111110000001110000000000000011100000000011100000000000000000000000000011100000000000111100011100000100000000111000111000000000000100000011100000...

output:

No

result:

ok single line: 'No'

Test #16:

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

input:

1000000 4
10000110000000010000110000111111111000010000111100001111111111111111111100001111111000011111111111111110000111000011111110000111111111111111111100001111111111110000111111111111111111000011111111111100001111111100000000111111111111111111111111100001110110000111111111111111111100001111100001...

output:

No

result:

ok single line: 'No'

Test #17:

score: 0
Accepted
time: 15ms
memory: 10280kb

input:

1000000 10
0000100000001111111111000000111111111100000001000001000000011111111110011111111110000000000000000011111111110000010000000000111111111011111111110000000011111111110000001111100000000001111100000001111111111000001111111111001111111111001111111111000001111111110000000000100000000000000000001...

output:

No

result:

ok single line: 'No'

Test #18:

score: 0
Accepted
time: 14ms
memory: 9780kb

input:

1000000 20
1000000000000000000001111111111100000000000000000000011111111110100000000000000000000111000000000000000000001111111100000000000000001111111111111111111100001111111111111111111111111111111111111011111111111111011111111111111111111111100000000111111111111111111110000000000001111110000000000...

output:

No

result:

ok single line: 'No'

Test #19:

score: 0
Accepted
time: 8ms
memory: 9256kb

input:

1000000 100
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111...

output:

No

result:

ok single line: 'No'

Test #20:

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

input:

1000000 200
000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111111...

output:

No

result:

ok single line: 'No'

Test #21:

score: 0
Accepted
time: 8ms
memory: 8008kb

input:

1000000 1000000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

Yes

result:

ok single line: 'Yes'

Test #22:

score: 0
Accepted
time: 8ms
memory: 9744kb

input:

1000000 999999
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

No

result:

ok single line: 'No'

Extra Test:

score: 0
Extra Test Passed