Submission #616874

# Submission time Handle Problem Language Result Execution time Memory
616874 2022-08-01T07:21:24 Z HappyPacMan Palinilap (COI16_palinilap) C++14
0 / 100
1000 ms 664 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;
	int n = s.size();
	int res = 0;
	for(int i=0;i<n;i++){
		char base = s[i];
		for(char j='a';j<='z';j++){
			int curr = 0;
			s[i] = j;
			for(int k=0;k<n;k++){
				for(int l=1;k+l<=n;l++){
					string v = s.substr(k,l);
					string w = v;
					reverse(w.begin(),w.end());
					if(v == w){
						curr++;
					}
				}
			}
			res = max(res,curr);
		}
		s[i] = base;
	}
	cout << res << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 511 ms 300 KB Output is correct
2 Execution timed out 1004 ms 296 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 664 KB Time limit exceeded
2 Halted 0 ms 0 KB -