Language: C++

#include <bits/stdc++.h>
using namespace std;
 
const int INF = 1145141919;
const long long INFL = 1LL<<60;
 
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
 
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
 
int dp[3*1100][3*1100] = {};
int main()
{
	string s,t;
	cin >> s >> t;
	s = "@" + s;
	t = "@" + t;
	for (int i = 1; i < s.size(); ++i)
	{
		for (int j = 1; j < t.size(); ++j)
		{
			if(s[i] == t[j])
			{
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else
			{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	int len = dp[s.size() - 1][t.size() - 1];
	int i = s.size() - 1;
	int j = t.size() - 1;
	string ans;
	while(len > 0)
	{
		if(s[i] == t[j])
		{
			ans += s[i];
			--i;
			--j;
			--len;
		}
		else if(dp[i][j] == dp[i-1][j])
		{
			--i;
		}
		else
		{
			--j;
		}
	}
	for (int i = 0; i < ans.size(); ++i)
	{
		cout << ans[ans.size() - 1 - i];
	}
	cout << endl;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

const int INF = 1145141919;
const long long INFL = 1LL<<60;

template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}

template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

int dp[3*1100][3*1100] = {};
int main()
{
	string s,t;
	cin >> s >> t;
	s = "@" + s;
	t = "@" + t;
	for (int i = 1; i < s.size(); ++i)
	{
		for (int j = 1; j < t.size(); ++j)
		{
			if(s[i] == t[j])
			{
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else
			{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	int len = dp[s.size() - 1][t.size() - 1];
	int i = s.size() - 1;
	int j = t.size() - 1;
	string ans;
	while(len > 0)
	{
		if(s[i] == t[j])
		{
			ans += s[i];
			--i;
			--j;
			--len;
		}
		else if(dp[i][j] == dp[i-1][j])
		{
			--i;
		}
		else
		{
			--j;
		}
	}
	for (int i = 0; i < ans.size(); ++i)
	{
		cout << ans[ans.size() - 1 - i];
	}
	cout << endl;
	return 0;
}
提出情報

Compiler output:
a.cc:80:11: error: redefinition of 'const int INF'
   80 | const int INF = 1145141919;
      |           ^~~
a.cc:4:11: note: 'const int INF' previously defined here
    4 | const int INF = 1145141919;
      |           ^~~
a.cc:81:17: error: redefinition of 'const long long int INFL'
   81 | const long long INFL = 1LL<<60;
      |                 ^~~~
a.cc:5:17: note: 'const long long int INFL' previously defined here
    5 | const long long INFL = 1LL<<60;
      |                 ^~~~
a.cc:83:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
   83 | template<class T> inline bool chmin(T& a, T b)
      |                               ^~~~~
a.cc:7:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
    7 | template<class T> inline bool chmin(T& a, T b)
      |                               ^~~~~
a.cc:93:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
   93 | template<class T> inline bool chmax(T& a, T b)
      |                               ^~~~~
a.cc:17:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   17 | template<class T> inline bool chmax(T& a, T b)
      |                               ^~~~~
a.cc:103:5: error: redefinition of 'int dp [3300][3300]'
  103 | int dp[3*1100][3*1100] = {};
      |     ^~
a.cc:27:5: note: 'int dp [3300][3300]' previously defined here
   27 | int dp[3*1100][3*1100] = {};
      |     ^~
a.cc:104:5: error: redefinition of 'int main()'
  104 | int main()
      |     ^~~~
a.cc:28:5: note: 'int main()' previously defined here
   28 | int main()
      |     ^~~~
a.cc:153:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
  153 | 提出情報
      | ^~~~~~~~