답안 #34053

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
34053 2017-11-06T16:12:52 Z mohammad_kilani 회문 (APIO14_palindrome) C++14
23 / 100
1000 ms 33912 KB
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define oo 2000000000
const int N = 10010;
int p = 10007;
bitset < N > can[N] ;
unordered_map <int,int> mp;
char s[N];


int main() {
	//freopen("in.txt","r",stdin);
	scanf("%s",s);
	int n = strlen(s);
	long long ans = 0 ;
	for(int i=0;i<n;i++){
		int idx = i;
		int idx2 = i;
		while(idx >= 0 && idx2 < n && s[idx] == s[idx2]){
			can[idx][idx2] = true;
			idx--;
			idx2++;
		}
		idx = i;
		idx2 = i + 1;
		while(idx >= 0 && idx2 < n && s[idx] == s[idx2]){
			can[idx][idx2] = true;
			idx--;
			idx2++;
		}
	}
	for(int i=0;i<n;i++){
		int tmp = 0 ;
		int po = 1;
		for(int j=i;j<n;j++){
			tmp+=(((long long)s[j] * po) % mod);
			tmp %= mod;
			po = (long long)(p * po) % mod;
			int cur = ++mp[tmp];
			if(can[i][j] && ans < ((long long)cur * (j-i+1))){
				ans = ((long long)cur * (j-i+1));
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Compilation message

palindrome.cpp: In function 'int main()':
palindrome.cpp:14:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s);
               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 14308 KB Output is correct
2 Correct 0 ms 14308 KB Output is correct
3 Correct 0 ms 14308 KB Output is correct
4 Correct 0 ms 14308 KB Output is correct
5 Correct 0 ms 14308 KB Output is correct
6 Correct 0 ms 14308 KB Output is correct
7 Correct 0 ms 14308 KB Output is correct
8 Correct 0 ms 14308 KB Output is correct
9 Correct 0 ms 14308 KB Output is correct
10 Correct 0 ms 14308 KB Output is correct
11 Correct 0 ms 14308 KB Output is correct
12 Correct 0 ms 14308 KB Output is correct
13 Correct 0 ms 14308 KB Output is correct
14 Correct 0 ms 14308 KB Output is correct
15 Correct 0 ms 14308 KB Output is correct
16 Correct 0 ms 14308 KB Output is correct
17 Correct 0 ms 14308 KB Output is correct
18 Correct 0 ms 14308 KB Output is correct
19 Correct 0 ms 14308 KB Output is correct
20 Correct 0 ms 14308 KB Output is correct
21 Correct 0 ms 14440 KB Output is correct
22 Correct 0 ms 14588 KB Output is correct
23 Correct 0 ms 14308 KB Output is correct
24 Correct 0 ms 14440 KB Output is correct
25 Correct 0 ms 14308 KB Output is correct
26 Correct 0 ms 14588 KB Output is correct
27 Correct 0 ms 14440 KB Output is correct
28 Correct 0 ms 14440 KB Output is correct
29 Correct 0 ms 14588 KB Output is correct
30 Correct 0 ms 14588 KB Output is correct
31 Correct 0 ms 14588 KB Output is correct
32 Correct 0 ms 14440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 14440 KB Output is correct
2 Correct 163 ms 28392 KB Output is correct
3 Correct 16 ms 14308 KB Output is correct
4 Correct 266 ms 32328 KB Output is correct
5 Correct 16 ms 14308 KB Output is correct
6 Correct 19 ms 14308 KB Output is correct
7 Correct 149 ms 28896 KB Output is correct
8 Correct 16 ms 14440 KB Output is correct
9 Correct 229 ms 32856 KB Output is correct
10 Correct 256 ms 33912 KB Output is correct
11 Correct 239 ms 33912 KB Output is correct
12 Correct 259 ms 30216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 15172 KB Execution timed out
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 136 ms 14308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 126 ms 14308 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -