QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#115382 | #6628. Flip it and Stick it | yyyyxh# | 0 | 0ms | 1644kb | C++17 | 664b | 2023-06-26 08:27:10 | 2024-05-31 14:12:43 |
Judging History
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%