Submission #447368

#TimeUsernameProblemLanguageResultExecution timeMemory
447368fuad27Palindromic Partitions (CEOI17_palindromic)C++14
60 / 100
10004 ms3188 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(); string l = "", r = ""; for(int i = 0;i<n/2;i++) { l += s[i]; r = s[n-i-1] + r; if(l == r){ l = ""; r = ""; ans+=2; } } if(l.size() > 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...