QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#443288#8743. 转化JowaireCompile Error//C++141.1kb2024-06-15 15:03:142024-06-15 15:03:15

Judging History

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

  • [2024-06-15 15:03:15]
  • 评测
  • [2024-06-15 15:03:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

typedef __int128 ll;
const int N=103,M=1003;
ll n,m,sum,a[N],f[N],g[N],c[M],len[M],b[M][N];
void write(ll X)
{
	if(X<0){putchar('-');X=~(X-1);}
	int s[50],o=0;
	while(X){s[++o]=X%10;X/=10;}
	if(!o)s[++o]=0;while(o)putchar(s[o--]+'0');
	putchar('\n');
}
int main()
{
	int _n,_m;cin>>_n>>_m;n=_n;m=_m;
	for(int i=1,x;i<=n;i++)cin>>x,a[i]=x,sum+=n*a[i];
	for(int i=1;i<=m;i++)
	{
		int _c,_len;cin>>_c>>_len;c[i]=_c;len[i]=_len;
		for(int j=1,x;j<=len[i];j++)cin>>x,b[i][j]=x;
	}
	for(int t=1;t<=n;t++)
	{
		ll fl=0;
		for(int i=1;i<=n;i++)f[i]=i==t;
		for(int tim=1;tim<=n;tim++)
		{
			for(int i=1;i<=n;i++)g[i]=f[i];
			for(int i=1;i<=m;i++)
			{
				ll x=0;
				for(int j=1;j<=len[i];j++)x+=g[b[i][j]];
				f[c[i]]=max(f[c[i]],x);
			}
			ll cnt=0;
			for(int i=1;i<=n;i++)cnt+=f[i]==g[i];
			if(cnt==n)break;
			fl|=tim==lim;ll s=0;
			for(int i=1;i<=n;i++)s+=f[i]*a[i];
		    if(s>(ll)1e33){fl=1;break;}
		}
		ll s=0;
		for(int i=1;i<=n;i++)s+=f[i]*a[i];
		if(fl)cout<<"infinity"<<endl;
		else write(s);
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:40:34: error: ‘lim’ was not declared in this scope; did you mean ‘tim’?
   40 |                         fl|=tim==lim;ll s=0;
      |                                  ^~~
      |                                  tim