QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#113928#6628. Flip it and Stick it1kri#4 2ms6552kbC++14844b2023-06-20 08:11:582024-05-31 14:07:45

Judging History

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

  • [2024-05-31 14:07:45]
  • 评测
  • 测评结果:4
  • 用时:2ms
  • 内存:6552kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-20 08:11:58]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char str0[2000005],str1[200005];
int n,m,a[200005],b[200005];
int main(){
	scanf("%s%s",str0+1,str1+1);
	n=strlen(str0+1),m=strlen(str1+1);
	for (int i=1;i<=n;i++)a[i]=str0[i]-'0';
	for (int i=1;i<=m;i++)b[i]=str1[i]-'0';
	if (b[1]==1){
		for (int i=1;i<=n;i++)a[i]^=1;
		for (int i=1;i<=m;i++)b[i]^=1;
	}
	if (n<m){
		cout<<0<<endl;
		return 0;
	}
	if (m==1){
		int fg=1;
		for (int i=1;i<=n;i++)
			if (a[i]==0)fg=0;
		if (fg==1)cout<<0<<endl;
		else cout<<-1<<endl;
		return 0;
	}
	if (m==2){
		if (b[2]==0){

		}
		else{
			int ans=0;
			for (int i=1;i<=n;i++){
				if (a[i]==0)continue;
				int j=i;
				while(j<n&&a[j+1]==1)j++;
				if (i!=1)ans++;
				i=j;
			}
			cout<<ans<<endl;
			return 0;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 1
Accepted
time: 1ms
memory: 5696kb

input:

1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 1
Accepted
time: 2ms
memory: 6352kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Subtask #2:

score: 3
Accepted

Test #8:

score: 3
Accepted
time: 1ms
memory: 5792kb

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 3
Accepted
time: 1ms
memory: 5696kb

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 3
Accepted
time: 1ms
memory: 5828kb

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 3
Accepted
time: 0ms
memory: 5896kb

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 3
Accepted
time: 1ms
memory: 5772kb

input:

1010101010
10

output:

5

result:

ok 1 number(s): "5"

Test #13:

score: 3
Accepted
time: 2ms
memory: 4772kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 3
Accepted
time: 2ms
memory: 5784kb

input:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 3
Accepted
time: 0ms
memory: 5832kb

input:

010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

100000

result:

ok 1 number(s): "100000"

Test #16:

score: 3
Accepted
time: 2ms
memory: 5648kb

input:

000110111001011000010001010010010000010100100000011101010000001000110011100000011011100101110110000001000000000011001010001101001110011111001101110010001100000000010000000100100011000111010011100110011101100011000100011001010000010001001010010101100000100000010010110000000001011100100001000010100100...

output:

43860

result:

ok 1 number(s): "43860"

Test #17:

score: 3
Accepted
time: 0ms
memory: 5832kb

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

44072

result:

ok 1 number(s): "44072"

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #18:

score: 4
Accepted
time: 1ms
memory: 5792kb

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #19:

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

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 4
Accepted
time: 1ms
memory: 5888kb

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #21:

score: 4
Accepted
time: 1ms
memory: 5828kb

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 4
Accepted
time: 1ms
memory: 5792kb

input:

1
00

output:

0

result:

ok 1 number(s): "0"

Test #23:

score: 4
Accepted
time: 1ms
memory: 5796kb

input:

1
11

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Wrong Answer
time: 1ms
memory: 5896kb

input:

10
00

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements

Subtask #4:

score: 0
Wrong Answer

Test #40:

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

input:

11
011

output:

0

result:

ok 1 number(s): "0"

Test #41:

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

input:

0
110

output:

0

result:

ok 1 number(s): "0"

Test #42:

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

input:

01
100

output:

0

result:

ok 1 number(s): "0"

Test #43:

score: 0
Wrong Answer
time: 1ms
memory: 5820kb

input:

110
110

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements

Subtask #5:

score: 0
Wrong Answer

Test #53:

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

input:

11
011

output:

0

result:

ok 1 number(s): "0"

Test #54:

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

input:

01
100

output:

0

result:

ok 1 number(s): "0"

Test #55:

score: 0
Wrong Answer
time: 1ms
memory: 5916kb

input:

011
011

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements

Subtask #6:

score: 0
Skipped

Dependency #4:

0%