Submission #447375

# Submission time Handle Problem Language Result Execution time Memory
447375 2021-07-26T08:05:46 Z fuad27 Palindromic Partitions (CEOI17_palindromic) C++14
0 / 100
0 ms 204 KB
    #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();
    		long long l = 0, r = 0;
    		for(int i = 0;i<n/2;i++) {
    			l += s[i];
    			r = s[n-i-1] + r;
    			if(l == r){
    				l = 0;
    				r = 0;
    				ans+=2;
    			}
    		}
    		if(l > 0 or n%2 == 1)ans++;
    		cout<<ans<<'\n';
    	}
    }
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -