Submission #362640

#TimeUsernameProblemLanguageResultExecution timeMemory
362640shahriarkhanPalindromic Partitions (CEOI17_palindromic)C++14
60 / 100
10006 ms6436 KiB
#include<bits/stdc++.h> using namespace std ; int main() { int t ; scanf("%d",&t) ; while(t--) { string s ; cin>>s ; int siz = s.size() , l = 0 , r = siz - 1 , len = 1 , ans = 0 ; while((l+len-1)<r) { int cur_l = l , cur_r = r , bad = 0 ; while(cur_l<(l+len)) { if(s[cur_l]==s[cur_r]) { ++cur_l , ++cur_r ; } else { bad = 1 ; break ; } } if(!bad) { l += len , len = 1 ; --r , ans += 2 ; } else { ++len , --r ; } } if(l<=r) ++ans ; printf("%d\n",max(1,ans)) ; } return 0 ; }

Compilation message (stderr)

palindromic.cpp: In function 'int main()':
palindromic.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d",&t) ;
      |     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...