제출 #1340432

#제출 시각아이디문제언어결과실행 시간메모리
1340432khangai11회문 (APIO14_palindrome)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll m1=998244353;
ll pwr(ll a,ll b){
	if(b==0){
		return 1;
	}
	ll ans=pwr(a,b/2);
	ans*=ans;
	ans%=m1;
	if(b%2==1){
		ans*=a;
		ans%=m1;
	}
	return ans;
}
void solve(){
	string s;
	cin>>s;
	vector<vector<ll>> sf(s.size(),vector<ll>(s.size()));
	for(ll a=0;a<s.size();a++){
		ll d=0;
		for(ll b=a;b<s.size();b++){
			d*=29;
			d+=(ll)(s[b]-'a'+1);
			d%=m1;
			sf[a][b]=d;
		}
	}
	for(ll a=s.size()-1;a>=0;a--){
		ll d=0;
		for(ll b=a;b>=0;b--){
			d*=29;
			d+=(ll)(s[b]-'a'+1);
			d%=m1;
			sf[a][b]=d;
		}
	}
	ll D=0;
	map<ll,ll> mp;
	for(ll a=0;a<s.size();a++){
		for(ll b=a;b<s.size();b++){
			if(sf[a][b]==sf[b][a]){
				mp[sf[a][b]]+=(b-a+1);
				D=max(D,mp[sf[a][b]]);
			}
		}
	}
	cout<<D<<endl;
signed main(){
	ios::sync_with_stdio();
	cin.tie(0);
	cout.tie(0);
//	freopen("a.in", "r", stdin);
//	freopen("a.out", "w", stdout);
	ll t=1;
//	cin>>t;
	for(ll a=0;a<t;a++){
		solve();
	}
}

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

palindrome.cpp: In function 'void solve()':
palindrome.cpp:52:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   52 | signed main(){
      |            ^~
palindrome.cpp:52:12: note: remove parentheses to default-initialize a variable
   52 | signed main(){
      |            ^~
      |            --
palindrome.cpp:52:12: note: or replace parentheses with braces to value-initialize a variable
palindrome.cpp:52:14: error: a function-definition is not allowed here before '{' token
   52 | signed main(){
      |              ^
palindrome.cpp:63:2: error: expected '}' at end of input
   63 | }
      |  ^
palindrome.cpp:19:13: note: to match this '{'
   19 | void solve(){
      |             ^