QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#115382#6628. Flip it and Stick ityyyyxh#0 0ms1644kbC++17664b2023-06-26 08:27:102024-05-31 14:12:43

Judging History

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

  • [2024-05-31 14:12:43]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:1644kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-26 08:27:10]
  • 提交

answer

#include <cstdio>
#include <cstring>
using namespace std;
const int N=100003;
char s[N],t[5];
int n;
int main(){
	scanf("%s%s",s+1,t);
	n=strlen(s+1);
	int tlen=strlen(t);
	if(tlen==1){
		for(int i=1;i<=n;++i)
			if(s[i]==*t){
				puts("-1");
				return 0;
			}
		puts("0");
		return 0;
	}
	if(tlen==2){
		if(t[0]=='0'&&t[1]=='1'){
			for(int i=1;i<=n;++i) s[i]^=1;
			t[0]='1';t[1]='0';
		}
		if(t[0]=='1'&&t[1]=='0'){
			int cnt=0;
			for(int l=1,r=1;l<=n;l=r){
				while(r<=n&&s[r]==s[l]) ++r;
				if(s[l]=='0') continue;
				else ++cnt;
			}
			if(s[n]=='1') --cnt;
			printf("%d\n",cnt);
			return 0;
		}
	}
	return 0;
}

詳細信息

Subtask #1:

score: 0
Runtime Error

Test #1:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

score: -1
Runtime Error

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #2:

score: 0
Runtime Error

Test #8:

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

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #11:

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

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

1010101010
10

output:

5

result:

ok 1 number(s): "5"

Test #13:

score: -3
Runtime Error

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #40:

score: 0
Wrong Answer
time: 0ms
memory: 1440kb

input:

11
011

output:


result:

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

Subtask #5:

score: 0
Wrong Answer

Test #53:

score: 0
Wrong Answer
time: 0ms
memory: 1508kb

input:

11
011

output:


result:

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

Subtask #6:

score: 0
Skipped

Dependency #4:

0%