#include <bits/stdc++.h>
// #pragma GCC optimize("O3", "unroll-loops")
#define ll long long
// #define int long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii, int> ipii;
const int MAXN = 3e5+20;
const int MAXA = 9e3+20;
const ll INF = 1e18+10;
const int LOG = 19;
const int MOD = 998244353;
const int SQRT = 450;
const vector<int> NOL = {};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const vector<int> dx = {1, -1, 0, 0};
const vector<int> dy = {0, 0, 1, -1};
int sum(int a, int b){ return ((ll)a+(ll)b)%MOD; }
int mul(int a, int b){ return (1ll*a*b)%MOD; }
int expo(int a, int b){
if(b==0) return 1;
int te = expo(a, b/2); te = mul(te, te);
return (b%2 ? mul(te, a) : te);
}
void chsum(int &a, int b){ a = ((ll)a+(ll)b)%MOD; }
void chmul(int &a, int b){ a = (1ll*a*b)%MOD; }
int n, dp[MAXN];
vector <int> adj[MAXN];
void dfs(int nw, int par){
dp[nw] = 1;
for(auto nx : adj[nw]){
if(nx==par) continue;
dfs(nx, nw);
}
for(auto nx : adj[nw]){
if(nx ==par) continue;
chmul(dp[nw], sum(dp[nx], 1));
}
// cout << nw << ' ' << dp[nw] << " p\n";
}
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int T; cin >> T;
while(T--){
string s; cin >> s; s = '.'+s;
int n = s.size()-1;
int l=1, r=n, ANS = 0;
string le = ""; le += s[1];
string ri = ""; ri += s[n];
while(l<r){
if(le != ri){
l++; le += s[l];
r--; ri = s[r]+ri;
} else {
// cout << le << ' ' << ri << " pp\n";
ANS++;
l++; r--;
le = ""; le += s[l];
ri = ""; ri += s[r];
}
}
cout << ANS*2+1 << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
7260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |