Submission #128039

# Submission time Handle Problem Language Result Execution time Memory
128039 2019-07-10T10:49:48 Z faustaadp Palindromic Partitions (CEOI17_palindromic) C++17
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
string s,s1,s2;
ll n,i,has,t;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>t;
	while(t--)
	{
		has=0;
		cin>>s;
		ll las1,las2;
		n=s.length();
		s1="";
		s2="";
		for(i=0;i<n;i++)
		{
			if(i>=(n-i-1))break;
			s1=s1+s[i];
			s2=s[n-i-1]+s2;
			if(s1==s2)
			{
				las1=i;
				las2=n-i-1;
				las1++;
				las2--;
				has+=2;
				s1="";
				s2="";
			}
		}
		if(las1<=las2)has++;
		cout<<has<<"\n";
	}
}

Compilation message

palindromic.cpp: In function 'int main()':
palindromic.cpp:38:3: warning: 'las2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(las1<=las2)has++;
   ^~
palindromic.cpp:38:3: warning: 'las1' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -