QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#461977#5037. 回文grass8cow#0 40ms10296kbC++171.1kb2024-07-03 11:32:432024-07-03 11:32:43

Judging History

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

  • [2024-07-03 11:32:43]
  • 评测
  • 测评结果:0
  • 用时:40ms
  • 内存:10296kb
  • [2024-07-03 11:32:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,q;
char c[201000],b[401000],a[400100];
int kmp[401000];
int bru(int m){
    for(int i=1;i<=m;i++)a[m-i+1]=a[i+m]=b[i];
    for(int i=2,j=0;i<=m*2;i++){
        while(j&&a[j+1]!=a[i])j=kmp[j];
        if(a[j+1]==a[i])j++;kmp[i]=j;
    }
    int u=m*2,s=0;while(u)s+=(u<=m),u=kmp[u];
    return s;
}
int OP[200100];
int L[200100],R[200100],X[200100],ans[200100];
char E[201000];
int main(){
    scanf("%s",c+1);n=strlen(c+1);
    scanf("%d",&q);
    for(int i=1;i<=q;i++){
        scanf("%d",&OP[i]);
        if(OP[i]==1){char o[2];scanf("%d%s",&X[i],o),E[i]=o[0];}
        else scanf("%d%d",&L[i],&R[i]);
    }
    for(int i=1;i<=q;i++)if(OP[i]==2){
        for(int j=i-1;j;j--){ans[j]=L[i]^1;if(OP[j]==2)break;}
    }
    for(int i=1;i<=q;i++){
        if(!ans[i]){
            if(OP[i]!=2)return 0;
            for(int i=1;i<=n;i++)b[i]=c[i];
            printf("%d\n",bru(n));
            return 0;
        }
        if(OP[i]==1){c[X[i]^ans[i]]=E[i];}
        else printf("%d\n",ans[i]);
    }
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 8108kb

input:

aabbbabbbaaaaaaabbabbbaaaabaaaabbaabbaabbaaababbbabbbbabbbbaaaabbbabbbbbaaabbbabbaaaaabbbbbaaababbabbaaaaabaabbbbaaababaaabbaabbabbbabbbbaaaaabbbbbbbabbbaabbbabbabbbababbabbbbaaaaabbaababbbbaabbaaaaaabaaabbbaaababbbbaabaaaaababababbbbbbaaaabbbbaaababaaabbaabbbbbaaaabbaaaabaaaaaababbababaaaabaaababaa...

output:

1452
4200
3249
873
1968
2123
910
2378
3233
30
104
959
2315
543
2015
4391
3217
1715
288
1183
1351
784
488
221
3853
2645
3444
1163
1691
35
3118
24
1498
989
512
2726
4170
857
3269
1532
1605
594
168
481
3261
4115
3056
2671
1104
622
2620
905
1215
90
736
949
762
2078
762
178
2198
1456
2533
93
318
505
3819...

result:

wrong answer 1st words differ - expected: '2', found: '1452'

Subtask #2:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 40ms
memory: 10184kb

input:

aabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbbaaabbaabbbbaabbaaabbbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbaaabaaaaaabaaabbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabb...

output:

98827
128603
76823
125337
90249
89237
47551
5531
1809
33933
110396
125974
111673
144282
4097
9782
160058
101338
55646
70978
138374
95522
14857
97802
11797
124802
90264
123532
24857
3309
98500
109093
108792
18803
34023
13780
107887
81108
27980
120275
139925
32871
4581
45477
39393
60919
73908
25552
12...

result:

wrong answer 1st words differ - expected: '41', found: '98827'

Subtask #3:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 20ms
memory: 10296kb

input:

abbaaaabbabaaaaaabaabbaabbababbaaabbabbbabaabaabaaaaabaabbbbabbabbabbbababbbababababbbbabaabbaaababbbbbababbbbaabbbaaabaababababaabbbbbbaababaabbaaabaabbaaababbabbabbbbaaaaabaaabbbabbbbbbabbbabbabaabbbbbbbaaaabbaaaababbbaaaaaaababaabbbbaaabaaabbaabbbbbbababbaabbaaabbabbbbbabaababbaabaaaabbbbabababba...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2

result:

wrong answer 1st words differ - expected: '2', found: '1'

Subtask #4:

score: 0
Wrong Answer

Test #27:

score: 0
Wrong Answer
time: 24ms
memory: 8812kb

input:

babbaaabbbbbbbabbbababaabbbbbababababbaabaabbbbbbabbbbbbbbbbababbbbabbaabbbaabaabbabbbaabbabbbabbababaababbbabbbbaabbabbabbaaaabbbaaabbbbaabbaaaaaaabbbabbbaaabaababaaabaaaabaaaababaaaaababaaaabaabbaaaabbbabbaabaabbbabbbbbaaabaababbbaaaaabbbbaaabbbbaabbabbbbabbbabbaaaaabaabaaaabbbabbbbbaabbbbabbbbaab...

output:


result:

wrong answer Unexpected EOF in the participants output

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%