QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61310#4437. Link with RunningExplodingKonjacRE 0ms0kbC++141.1kb2022-11-12 09:08:592022-11-12 09:09:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-12 09:09:01]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2022-11-12 09:08:59]
  • 提交

answer

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

using LL=long long;
using LD=long double;
using UI=unsigned int;
using ULL=unsigned long long;
using I128=__int128;
using U128=unsigned __int128;
constexpr LL INF=4e18;

int T,n,m;
struct Node
{
	LL d1,d2;
	Node()=default;
	Node(LL _d1,LL _d2): d1(_d1),d2(_d2){}
	inline Node operator +(const Node &rhs)const
		{ return Node(d1+rhs.d1,d2+rhs.d2); }
	inline bool operator <(const Node &rhs)const
		{ return d1!=rhs.d1?d1<rhs.d1:d2>rhs.d2; }
	inline bool operator >(const Node &rhs)const
		{ return rhs<*this; }
}dis[1005][1005];
int main()
{
	ios::sync_with_stdio(false);
//	cin.tie(nullptr),cout.tie(nullptr);
	cin>>T;
	while(T--)
	{
		cin>>n>>m;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				dis[i][j]=((i==j)?Node(0,0):Node(INF,-INF));
		for(int i=1,u,v,w1,w2;i<=m;i++)
			cin>>u>>v>>w1>>w2,dis[u][v]=min(dis[u][v],Node(w1,w2));
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				for(int k=1;k<=n;k++)
					dis[j][k]=min(dis[j][k],dis[j][i]+dis[i][k]);
		cout<<dis[1][n].d1<<' '<<(dis[1][n].d2<0?-INF:dis[1][n].d2)<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

12
100000 200000
1 2 838279516 902819511
1 3 293478832 513256010
2 4 682688353 204481674
2 5 360092507 651108247
5 6 519851939 323803002
6 7 675439277 205804465
7 8 419167205 386168059
6 9 140767493 382483305
9 10 558115401 613738466
9 11 902235661 744659643
9 12 851394758 1720015
12 13 635355827 46...

output:


result: