#include<bits/stdc++.h>
#define int long long
using namespace std;
int pierw=31;
int potega[2000000];
int32_t main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
int n;
cin>>n;
potega[0]=1;
for(int i=1;i<=1000000;i++)
potega[i]=potega[i-1]*pierw;
for(int i=1;i<=n;i++)
{
string s;
cin>>s;
int l=0,r=s.length()-1;
int jeden=0,dwa=0;
int wynik=1;
int dl=0;
while(l<r)
{
jeden*=pierw;
jeden+=s[l]-'a';
dwa+=potega[dl]*(s[r]-'a');
if(jeden==dwa)
{
if(r-1==l)
wynik--;
wynik+=2;
dl=-1;
jeden=0,dwa=0;
}
l++;
r--;
dl++;
}
cout<<wynik<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8148 KB |
Output is correct |
2 |
Correct |
5 ms |
8132 KB |
Output is correct |
3 |
Correct |
5 ms |
8148 KB |
Output is correct |
4 |
Correct |
6 ms |
8088 KB |
Output is correct |
5 |
Correct |
5 ms |
8136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8148 KB |
Output is correct |
2 |
Correct |
5 ms |
8132 KB |
Output is correct |
3 |
Correct |
5 ms |
8148 KB |
Output is correct |
4 |
Correct |
6 ms |
8088 KB |
Output is correct |
5 |
Correct |
5 ms |
8136 KB |
Output is correct |
6 |
Correct |
5 ms |
8148 KB |
Output is correct |
7 |
Correct |
5 ms |
8040 KB |
Output is correct |
8 |
Correct |
4 ms |
8148 KB |
Output is correct |
9 |
Correct |
5 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8148 KB |
Output is correct |
2 |
Correct |
5 ms |
8132 KB |
Output is correct |
3 |
Correct |
5 ms |
8148 KB |
Output is correct |
4 |
Correct |
6 ms |
8088 KB |
Output is correct |
5 |
Correct |
5 ms |
8136 KB |
Output is correct |
6 |
Correct |
5 ms |
8148 KB |
Output is correct |
7 |
Correct |
5 ms |
8040 KB |
Output is correct |
8 |
Correct |
4 ms |
8148 KB |
Output is correct |
9 |
Correct |
5 ms |
8148 KB |
Output is correct |
10 |
Correct |
6 ms |
8276 KB |
Output is correct |
11 |
Correct |
5 ms |
8148 KB |
Output is correct |
12 |
Correct |
5 ms |
8264 KB |
Output is correct |
13 |
Correct |
5 ms |
8208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8148 KB |
Output is correct |
2 |
Correct |
5 ms |
8132 KB |
Output is correct |
3 |
Correct |
5 ms |
8148 KB |
Output is correct |
4 |
Correct |
6 ms |
8088 KB |
Output is correct |
5 |
Correct |
5 ms |
8136 KB |
Output is correct |
6 |
Correct |
5 ms |
8148 KB |
Output is correct |
7 |
Correct |
5 ms |
8040 KB |
Output is correct |
8 |
Correct |
4 ms |
8148 KB |
Output is correct |
9 |
Correct |
5 ms |
8148 KB |
Output is correct |
10 |
Correct |
6 ms |
8276 KB |
Output is correct |
11 |
Correct |
5 ms |
8148 KB |
Output is correct |
12 |
Correct |
5 ms |
8264 KB |
Output is correct |
13 |
Correct |
5 ms |
8208 KB |
Output is correct |
14 |
Correct |
32 ms |
20548 KB |
Output is correct |
15 |
Correct |
22 ms |
15636 KB |
Output is correct |
16 |
Correct |
28 ms |
19628 KB |
Output is correct |
17 |
Correct |
22 ms |
14688 KB |
Output is correct |