QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#238449#7697. Impartial Stringswillow#WA 0ms3756kbC++171020b2023-11-04 16:46:082023-11-04 16:46:09

Judging History

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

  • [2023-11-04 16:46:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3756kb
  • [2023-11-04 16:46:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 5e2 + 5;

char A[N], s[N], t[N];


void rmain() {
    scanf("%s%s%s", A, s, t);
    int la = strlen(A), ls = strlen(s), lt = strlen(t);
    int cnt = 0;

    if(ls < lt) {
        swap(ls, lt);
        swap(s, t);
    }

    for(int i = 0; i < ls - lt + 1; ++ i) {
        bool ok = 1;
        for(int j = 0; j < lt; ++ j) {
            ok &= (s[i + j] == t[j]);
        }
        if(ok) ++ cnt;
    }
    if(cnt > 1) {
        puts("0");
        return;
    }
    if(cnt == 1) {
        puts("1");
        return;
    }
    if(la > 2) {
        puts("0");
        return;
    }
    if(ls != 2 || lt != 2) {
        puts("0");
        return;
    }
    if(s[0] == s[1] || t[0] == t[1]) {
        puts("0");
        return;
    }
    if(s[0] != t[1] || s[1] != t[0]) {
        puts("0");
        return;
    }
    puts("1");
}

int main() {
    int T;
    for(cin >> T; T --;) {
        rmain();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3752kb

input:

3
ab ab ba
abc ab ba
cz cczz zzcc

output:

1
0
0

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3756kb

input:

7
d d d
d dd d
d d dd
z zzzzzzzzzzzz zzz
a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1
0
0
0
1
0
0

result:

wrong answer 2nd lines differ - expected: '1', found: '0'