Submission #447375

#TimeUsernameProblemLanguageResultExecution timeMemory
447375fuad27Palindromic Partitions (CEOI17_palindromic)C++14
0 / 100
0 ms204 KiB
#include<iostream> using namespace std; #define int long long #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") int32_t main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--) { string s; cin >> s; int ans = 0, n = s.length(); long long l = 0, r = 0; for(int i = 0;i<n/2;i++) { l += s[i]; r = s[n-i-1] + r; if(l == r){ l = 0; r = 0; ans+=2; } } if(l > 0 or n%2 == 1)ans++; cout<<ans<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...