답안 #135019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
135019 2019-07-23T14:26:28 Z ly20 회문 (APIO14_palindrome) C++17
8 / 100
1000 ms 1160 KB
#include<bits/stdc++.h>
using namespace std;
string s;
bool check(int ini,int fim)
{
	while(ini<fim)
	{
		if(s[ini]!=s[fim])return false;
		ini++;fim--;
	}
	return true; 
}
int count(int ini,int fim)
{
	int rs=0;
	int tam=s.size();
	for(int i=0;i<tam-fim+ini ;i++)
	{
		bool ok=true;
		for(int j=i;j<i+fim-ini+1;j++)
		{
			if(s[j]!=s[j-i+ini])
			{
				ok=false;
				break;
			}
		}
		if(ok)
		{
			rs++;
			//printf("%d %d + 1\n",i,i+fim-ini+1);
		}
	}
	return rs;
}
int main()
{
	cin>>s;
	int tam=s.size();
	int resp=0;
	for(int i=0;i<tam;i++)
	{
		for(int j=i;j<tam;j++)
		{
			if(!check(i,j))continue;
			int cnt=count(i,j);
			resp=max(resp,(j-i+1)*cnt);
			//printf("%d %d %d %d\n",i,j,j-i+1,cnt);
		}
	}
	printf("%d\n",resp);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 356 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 400 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 8 ms 376 KB Output is correct
24 Correct 3 ms 256 KB Output is correct
25 Correct 7 ms 252 KB Output is correct
26 Correct 3 ms 256 KB Output is correct
27 Correct 2 ms 380 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 356 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1072 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1073 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1041 ms 1160 KB Time limit exceeded
2 Halted 0 ms 0 KB -