# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706990 | 2023-03-08T08:34:55 Z | ToroTN | Palindromic Partitions (CEOI17_palindromic) | C++14 | 16 ms | 15956 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long ll t,cnt_67,cnt_97,pow_97[1000005],pow_67[1000005],MOD=1e9+7,it; ll cnt2_67,cnt2_97,cnt; string s; int main() { ios_base::sync_with_stdio(0),cin.tie(0); pow_97[0]=1; pow_67[0]=1; for(int i=1;i<=1000000;i++) { pow_97[i]=pow_97[i-1]*97; pow_97[i]%=MOD; pow_67[i]=pow_67[i-1]*67; pow_67[i]%=MOD; } cin >> t; while(t--) { cin >> s; cnt_97=0; cnt_67=0; cnt2_97=0; cnt2_67=0; it=0; cnt=0; for(int i=0;i<s.size()/2;i++) { cnt_67+=pow_67[it]*s[i]; cnt_97+=pow_97[it]*s[i]; cnt2_67*=67; cnt2_67+=s[s.size()-1-i]; cnt2_97*=97; cnt2_97+=s[s.size()-1-i]; ++it; if(cnt2_67==cnt_67&&cnt2_97==cnt_97) { cnt_67=0; cnt2_67=0; cnt_97=0; cnt2_97=0; ++cnt; it=0; } } printf("%lld\n",2*cnt+1); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 15956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 15956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 15956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 15956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |