제출 #33964

#제출 시각아이디문제언어결과실행 시간메모리
33964mohammad_kilani회문 (APIO14_palindrome)C++14
8 / 100
216 ms131072 KiB
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define oo 2000000000 const int N = 1010; bool can[N][N]; unordered_map <string,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++){ string tmp; for(int j=i;j<n;j++){ tmp+=s[j]; int cur = ++mp[tmp]; if(can[i][j] && ans < ((long long)cur * (j-i+1))){ ans = ((long long)cur * (j-i+1)); } } } cout << ans << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

palindrome.cpp: In function 'int main()':
palindrome.cpp:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s);
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...