QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212642#6825. Expenditure Reductionnameless_story#Compile Error//C89777b2023-10-13 18:53:162023-10-13 18:53:17

Judging History

你现在查看的是最新测评结果

  • [2023-10-13 18:53:17]
  • 评测
  • [2023-10-13 18:53:16]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T1,class T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; }return 0; }
#define all(x) (x).begin(),(x).end()
void solve()
{
	string s1,s2; cin>>s1>>s2;
	int n=s1.size(),m=s2.size();
	vector f(n,vector(m,-1));
	int l=0,r=n;
	for (int i=0; i<n; ++i)
	{
		if (s1[i]==s2[0])
		{
			f[i][0]=i;
		}
		for (int j=1; j<m; ++j)
		{
			if (i>0&&s1[i]==s2[j])
			{
				cmax(f[i][j],f[i-1][j]);
			}
		}
		if (f[i][m-1]>=0)
		{
			if (i+1-f[i][m-1]<r-l)
			{
				r=i+1;
				l=f[i][m-1];
			}
		}
	}
	for (int i=l; i<r; ++i) cout<<s1[i];
	cout<<'\n';
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int T; cin>>T;
	while (T--)
	{
		solve();
	}
}

详细

answer.code:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include"bits/stdc++.h"
      |         ^~~~~~~~~~~~~~~
compilation terminated.