QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#442390 | #8743. 转化 | Jowaire# | WA | 93ms | 4520kb | C++14 | 761b | 2024-06-15 11:35:41 | 2024-06-15 11:35:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=103,M=1003;
ll n,m,a[N],f[N],g[N],c[M],len[M],b[M][N];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=m;i++)
{
cin>>c[i]>>len[i];
for(int j=1;j<=len[i];j++)cin>>b[i][j];
}
for(int t=1;t<=n;t++)
{
for(int i=1;i<=n;i++)f[i]=i==t;
for(int tim=1;tim<=n*n*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;
}
ll s=0;
for(int i=1;i<=n;i++)s+=f[i]*a[i];
if(s>=n*n)cout<<"infinity"<<endl;
else cout<<s<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 93ms
memory: 4520kb
input:
100 1000 327 833 558 253 722 710 811 779 789 919 750 288 611 674 670 264 815 701 304 615 9 943 713 633 392 706 687 847 78 999 368 55 913 61 686 512 696 0 695 285 485 877 533 54 621 925 339 319 597 536 285 701 186 933 234 360 284 546 545 185 112 735 147 851 824 512 695 734 237 381 777 449 880 675 614...
output:
infinity -3526462776252277019 965 infinity -6765287234726851858 infinity infinity infinity infinity infinity infinity infinity -6914791635939136112 infinity -2040466223457275811 infinity infinity infinity -6904561699137485275 infinity infinity infinity infinity infinity infinity infinity -6340383927...
result:
wrong answer 1st lines differ - expected: '2155053232761438', found: 'infinity'