Submission #243214

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2432142020-06-30 14:46:03kimbj0709Palindromic Partitions (CEOI17_palindromic)C++14
100 / 100
84 ms20708 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000009
#define maxn 1000050
#define po 179
vector<int> powers(maxn,1);
void find(){
string input;
cin >> input;
int sum1 = 0;
int sum2 = 0;
int ans = 0;
int cnt = -1;
int currcnt = 0;
for(int i=0;i<input.length()/2;i++){
sum1 += powers[currcnt]*(input.at(i)-'a');
sum2 *= po;
sum1 %= mod;
sum2 %= mod;
sum2 += (input.at(input.length()-1-i)-'a');
currcnt++;
sum2 %= mod;
if(sum1==sum2){
ans += 2;
sum1 = 0;
sum2 = 0;
cnt = i;
currcnt = 0;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

palindromic.cpp: In function 'void find()':
palindromic.cpp:16:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<input.length()/2;i++){
               ~^~~~~~~~~~~~~~~~~
palindromic.cpp:32:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if((cnt+1)*2==input.length()){
      ~~~~~~~~~^~~~~~~~~~~~~~~~
palindromic.cpp: In function 'int32_t main()':
palindromic.cpp:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=1;i<powers.size();i++){
               ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...