QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#461980#5037. 回文grass8cow#10 40ms10388kbC++171.1kb2024-07-03 11:34:092024-07-03 11:34:09

Judging History

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

  • [2024-07-03 11:34:09]
  • 评测
  • 测评结果:10
  • 用时:40ms
  • 内存:10388kb
  • [2024-07-03 11:34:09]
  • 提交

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]);
    }
    bool gg=0;
    for(int i=1;i<=q;i++)if(OP[i]==2){
        gg=1;
        for(int j=i-1;j;j--){ans[j]=L[i]^1;if(OP[j]==2)break;}
    }
    if(!gg)return 0;
    for(int i=1;i<=q;i++){
        if(!ans[i]&&OP[i]==2){
            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: 8088kb

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: 9456kb

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: 27ms
memory: 10292kb

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: 10
Accepted

Test #27:

score: 10
Accepted
time: 26ms
memory: 10268kb

input:

babbaaabbbbbbbabbbababaabbbbbababababbaabaabbbbbbabbbbbbbbbbababbbbabbaabbbaabaabbabbbaabbabbbabbababaababbbabbbbaabbabbabbaaaabbbaaabbbbaabbaaaaaaabbbabbbaaabaababaaabaaaabaaaababaaaaababaaaabaabbaaaabbbabbaabaabbbabbbbbaaabaababbbaaaaabbbbaaabbbbaabbabbbbabbbabbaaaaabaabaaaabbbabbbbbaabbbbabbbbaab...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 100490 tokens

Test #28:

score: 0
Accepted
time: 30ms
memory: 10380kb

input:

lqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlfibyjjybiflqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqlewwelqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvdqllqdvhpozemuhtibmunxftkdjjdktfxnumbithumezophvd...

output:

487
218
218
140
154
154
148
148
64
64
334
160
7
7
7
7
7
7
7
101
101
91
91
6
6
442
143
429
121
113
113
54
33
33
33
33
172
172
149
33
33
33
33
33
33
33
355
355
355
338
272
272
57
57
57
57
29
29
29
29
29
109
109
9
9
9
9
9
9
9
238
238
238
238
163
163
163
194
194
186
186
83
83
406
266
79
79
79
79
79
79
7...

result:

ok 66667 tokens

Test #29:

score: 0
Accepted
time: 30ms
memory: 10368kb

input:

vbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvwwxxlwqetrlgyolqqloyglrteqwlxxwwvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvwwxxlwqetrlgyolqqloyglrteqwlxxwwvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzaxhgbvvbghxazviovddvoivzax...

output:

13
8
13
5
5
5
13
12
5
5
5
5
5
5
5
5
12
12
12
12
12
12
12
13
9
9
5
13
13
12
12
12
12
12
12
13
13
13
13
13
12
12
12
13
13
13
13
13
12
12
12
12
12
13
5
5
13
13
13
13
13
13
13
12
12
12
12
11
6
6
13
5
13
13
13
13
11
11
11
11
8
8
8
8
8
8
8
13
13
13
13
13
5
5
5
5
5
13
12
12
9
9
9
9
9
9
9
12
12
12
12
12
12
...

result:

ok 66667 tokens

Test #30:

score: 0
Accepted
time: 27ms
memory: 10376kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000...

result:

ok 66667 tokens

Test #31:

score: 0
Accepted
time: 33ms
memory: 10304kb

input:

ghiifdahihabedjhaaagicjebeaeaefagddbhdjijffjeebbhhheghafibahfcegfeccfhejdhceiiihfeccbdgjdiddhbbdafjhiejbbaihdddhcgcebgdibhbeididbcabjgghdhgajidbfbfehabfaggifgabhfjcehgjhhcfiihhdhgchacicdeahjcjcjcdfdbfigdfeghacfgafahifegafheibbdieadaijeahfhadiefajgchjefhicaaificdafifadcfddahadhbaegdchhijefdbhgicfggfc...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 100279 tokens

Test #32:

score: 0
Accepted
time: 30ms
memory: 10364kb

input:

jheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaaeffadebbedaffeaadbejheehjjheehjebdaae...

output:

21
21
21
21
21
21
21
21
17
21
21
21
21
21
21
21
21
20
21
20
20
21
21
21
21
21
20
21
21
21
21
21
21
21
21
20
21
21
21
21
21
21
21
21
21
21
21
20
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
13
21
21
21
21
20
21
21
21
21
21
21
21
21
21
21
14
21
21
21
21
21
21
21
21
21
21
21
21
17
21
...

result:

ok 66666 tokens

Test #33:

score: 0
Accepted
time: 30ms
memory: 10388kb

input:

babaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababaababaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababbabaababaababaababbabaababbabaababbabaababbabaababbabaababbabaabab...

output:

56
46
69
41
76
76
36
76
57
76
76
54
76
76
60
32
30
76
76
49
76
76
76
76
27
53
72
76
76
64
76
76
29
57
47
76
29
76
76
76
76
36
74
76
76
76
76
76
76
76
76
27
76
76
15
76
76
76
76
46
49
76
76
62
76
66
76
76
76
76
74
70
76
50
51
76
76
76
76
76
76
76
41
76
61
76
76
70
42
44
76
76
35
73
35
76
76
57
76
76
...

result:

ok 66666 tokens

Test #34:

score: 0
Accepted
time: 27ms
memory: 10388kb

input:

abbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaabbaabbaabbaabbaaaab...

output:

4079
4079
513
513
513
513
513
11113
11113
3338
1846
1846
1846
4331
2774
4198
4198
4198
4198
2320
2320
2320
11113
11113
1054
1054
1054
1054
1054
1054
1054
1054
11113
11113
5955
5955
5955
5955
4318
4318
4318
4318
4318
4318
11113
11113
10532
10532
5226
5226
5226
3399
3399
3399
3399
3399
11113
11113
111...

result:

ok 66667 tokens

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%