QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#188225#4096. 코딩 테스트Lynkcat#Compile Error//C++201.9kb2023-09-25 16:57:492024-07-04 02:09:05

Judging History

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

  • [2024-07-04 02:09:05]
  • 评测
  • [2023-09-25 16:57:49]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
// #define mod 998244353
#define sz(x) ((int)((x).size()))
using Int=int;
#define int ll
// #define N 
using namespace std;
const int N=1405,mod=1000000007;
int tmp[N][N],nxt[N][N],a[N],f[N][N],g[N][N];
Int count(std::vector<Int> P)
{
	int n=P.size();
	for (int i=1;i<=n;i++)
	{
		if (P[i-1]>0)
			a[i+1]=P[i-1]+n+2;
		else a[i+1]=-P[i-1];
	}
	n+=2;
	a[1]=n-1;
	a[n]=n+n;
	for (int j=1;j<=n+n;j++) nxt[n+1][j]=n+1;
	for (int i=n;i>=1;i--)
	{
		for (int j=1;j<=n+n;j++)
			nxt[i][j]=nxt[i+1][j];
		nxt[i][a[i]]=i;
	}
	// for (int i=1;i<=n;i++)
	// {
	// 	cout<<a[i]<<" ";
	// }
	// cout<<'\n';
	for (int i=1;i<=n;i++)
		if (a[i]<=n)
			for (int j=1;j<=n;j++)
				if (nxt[i+1][j+n]<=n&&j!=a[i])
					f[i][nxt[i+1][j+n]]=(f[i][nxt[i+1][j+n]]+1)%mod;
	// return 0;
	for (int i=n;i>=1;i--)
		for (int j=i;j<=n;j++)
			if (a[j]>n)
			{
				
				// cout<<i<<" "<<j<<" "<<f[i][j]<<" "<<a[i]<<endl;
				if (a[i]<=n)
				{
					int sum=0;
					for (int k=1;k<=n;k++)
						if (k!=a[i])
						{
							int l=nxt[i+1][k];
							if (l<=j)
								sum=(sum+g[l][j])%mod;
						}
					for (int k=1;k<=n;k++)
						if (k!=a[i]&&k!=a[j]-n)
						{
							int l=nxt[j+1][k+n];
							if (l<=n)
							{
								f[i][l]=(f[i][l]+sum)%mod;
							}
						}
					g[i][j]=f[i][j];
					for (int k=i+1;k<j;k++)
						g[i][j]=(g[i][j]+g[i][k]*tmp[k][j]%mod)%mod;
				}
				else
				{
					for (int k=1;k<=n;k++)
						if (k!=a[i]-n&&nxt[i+1][k]<=j)
						{
							tmp[i][j]=(tmp[i][j]+f[nxt[i+1][k]][j])%mod;
						}
				}
				// if (f[i][j])
				// 	cout<<i<<" "<<j<<" "<<f[i][j]<<endl;
			}
	return (f[1][n]-1+mod)%mod;
}

詳細信息

/usr/bin/ld: /tmp/ccXeAfzg.o: in function `main':
implementer.cpp:(.text.startup+0x21f): undefined reference to `testset(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status