結果

問題 No.1344 Typical Shortest Path Sum
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2021-02-04 03:26:22
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,768 bytes
コンパイル時間 2,393 ms
コンパイル使用メモリ 108,064 KB
実行使用メモリ 24,876 KB
最終ジャッジ日時 2023-09-12 22:37:39
合計ジャッジ時間 12,186 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
22,912 KB
testcase_01 AC 61 ms
20,648 KB
testcase_02 AC 61 ms
20,756 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 60 ms
18,928 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 61 ms
20,796 KB
testcase_11 AC 61 ms
20,984 KB
testcase_12 WA -
testcase_13 AC 61 ms
20,904 KB
testcase_14 WA -
testcase_15 AC 62 ms
22,836 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 63 ms
23,016 KB
testcase_21 WA -
testcase_22 AC 61 ms
22,868 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 62 ms
20,824 KB
testcase_26 WA -
testcase_27 AC 61 ms
20,852 KB
testcase_28 WA -
testcase_29 AC 61 ms
20,680 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 62 ms
20,760 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 62 ms
20,808 KB
testcase_36 AC 61 ms
20,904 KB
testcase_37 WA -
testcase_38 AC 62 ms
22,836 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 64 ms
22,752 KB
testcase_61 AC 63 ms
20,792 KB
testcase_62 AC 79 ms
22,844 KB
testcase_63 AC 63 ms
22,768 KB
testcase_64 AC 64 ms
20,864 KB
testcase_65 AC 65 ms
20,800 KB
testcase_66 AC 64 ms
22,772 KB
testcase_67 AC 65 ms
20,820 KB
testcase_68 AC 63 ms
20,796 KB
testcase_69 AC 64 ms
20,716 KB
testcase_70 WA -
testcase_71 WA -
testcase_72 AC 61 ms
20,696 KB
testcase_73 AC 61 ms
20,784 KB
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Threading;
using System.Runtime.CompilerServices;
static class Program{
	const int mod=(int)1e9+7;
	const long inf=long.MaxValue>>1;
	static bool[] b;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		int n=s[0],m=s[1];//n-1;
		b=new bool[n+1];
		var wf=new long[n+1][];
		for(int i=1;i<=n;i++){
			wf[i]=new long[n+1];
			for(int j=1;j<=n;j++){
				if(i!=j){wf[i][j]=inf;}
			}
		}
		for(int i=0;i<m;i++){
			var e=sc.La;
			wf[e[0]][e[1]]=e[2];
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				for(int k=1;k<=n;k++){wf[j][k]=Min(wf[j][k],wf[j][i]+wf[i][k]);}
			}
		}
		StringBuilder sb=new StringBuilder();
		for(int i=1;i<=n;i++){
			long ans=0;
			for(int j=1;j<=n;j++){
				if(wf[i][j]<inf){ans+=wf[i][j];}
			}
			sb.Append(ans+"\n");
		}
		Console.Write(sb);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0