QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411680#3788. Funny Car Racing23lpx0 43ms31644kbC++141.4kb2024-05-15 17:43:302024-05-15 17:43:30

Judging History

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

  • [2024-05-15 17:43:30]
  • 评测
  • 测评结果:0
  • 用时:43ms
  • 内存:31644kb
  • [2024-05-15 17:43:30]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e12+99;
const int N=1e3+9;
int st[N],d[N];
int n,m,s,t,idx;
struct PII{
	int d,a,b;
};
vector<PII>g[N][N];
void init()
{
	for(int i=1;i<=n;i++)
	{
		st[i]=0,d[i]=inf;
		for(int j=1;j<=n;j++)
		{
			g[i][j].clear();
		}
	}
}
int dic(int d,int tt,int a,int b)
{
	int x=a,y=b;
	int sum=x+y;
	sum=d%sum;
	if(sum+tt<=x)
	{
		return tt+d;
	}
	else
	{
		int res=d+x+y-sum;
		res+=tt;
		return res;	
	}
}
int mmin(int x,int y,int d)
{
	int res=inf;
	for(auto&x:g[x][y])
	{
		res=min(res,dic(d,x.d,x.a,x.b));
	}
	return res;
}
void djstl(int x)
{
	d[s]=0;
	while(x--)
	{
		int t=-1;
		for(int i=1;i<=n;i++)
		{
//			printf("i=%lld t=%lld d[t]=%lld\n",i,t,d[t]);
			if(st[i]==0&&(t==-1||d[i]<d[t]))
			{
				t=i;
			}
		}
		st[t]=1;
		for(int i=1;i<=n;i++)
		{
//			printf("t=%lld i=%lld dic=%lld\n",t,i,dic(d[t],t,i));
			d[i]=min(d[i],mmin(t,i,d[t]));
		}
//		printf("t=%lld\n",t);
//		for(int i=1;i<=n;i++)printf("%lld ",d[i]);
//		printf("\n");
	}
	int ans=d[t];
	printf("Case %lld: %lld\n",++idx,ans);
}
void solve()
{
	
	init();
	while(m--)
	{
		int x,y,d,a,b;
		cin>>x>>y>>a>>b>>d;
		PII tt={d,a,b};
		g[x][y].push_back(tt);
		g[y][x]=g[x][y];
	}
	djstl(n);
}
signed main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	while(cin>>n>>m>>s>>t)
	{
		solve();
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 43ms
memory: 31644kb

input:

155 9507 117 14
19 18 2 123 1
100 97 4 155 3
121 120 1 140 1
5 8 1 121 1
69 66 2 107 2
151 150 2 190 1
68 69 1 101 1
61 60 2 126 1
124 127 2 160 3
59 55 5 133 4
66 67 1 189 1
94 96 2 108 2
65 63 2 181 2
44 48 1 130 1
28 29 1 180 1
5 6 1 107 1
29 28 1 120 1
142 140 4 152 2
46 45 2 113 1
85 88 6 163 3...

output:

Case 1: 158
Case 2: 689
Case 3: 847
Case 4: 155
Case 5: 445
Case 6: 295
Case 7: 154
Case 8: 429
Case 9: 292
Case 10: 176
Case 11: 224
Case 12: 197
Case 13: 835
Case 14: 514
Case 15: 167
Case 16: 180
Case 17: 264
Case 18: 355
Case 19: 347
Case 20: 194
Case 21: 192
Case 22: 406
Case 23: 561
Case 24: 3...

result:

wrong answer 1st lines differ - expected: 'Case 1: 249', found: 'Case 1: 158'