結果

問題 No.1344 Typical Shortest Path Sum
ユーザー tailstails
提出日時 2021-08-13 17:58:34
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,041 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 35,876 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 11:48:35
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 1 ms
6,944 KB
testcase_32 AC 0 ms
6,940 KB
testcase_33 AC 1 ms
6,940 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 1 ms
6,940 KB
testcase_36 AC 1 ms
6,944 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 0 ms
6,940 KB
testcase_39 AC 1 ms
6,940 KB
testcase_40 AC 2 ms
6,944 KB
testcase_41 AC 2 ms
6,944 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 2 ms
6,944 KB
testcase_45 AC 2 ms
6,944 KB
testcase_46 AC 2 ms
6,948 KB
testcase_47 AC 2 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 AC 2 ms
6,940 KB
testcase_50 AC 2 ms
6,944 KB
testcase_51 AC 2 ms
6,940 KB
testcase_52 AC 2 ms
6,940 KB
testcase_53 AC 2 ms
6,944 KB
testcase_54 AC 2 ms
6,940 KB
testcase_55 AC 2 ms
6,944 KB
testcase_56 AC 2 ms
6,944 KB
testcase_57 AC 2 ms
6,944 KB
testcase_58 AC 2 ms
6,944 KB
testcase_59 AC 2 ms
6,940 KB
testcase_60 AC 1 ms
6,940 KB
testcase_61 AC 1 ms
6,944 KB
testcase_62 AC 1 ms
6,944 KB
testcase_63 AC 1 ms
6,940 KB
testcase_64 AC 1 ms
6,940 KB
testcase_65 AC 1 ms
6,940 KB
testcase_66 AC 1 ms
6,940 KB
testcase_67 AC 1 ms
6,940 KB
testcase_68 AC 2 ms
6,944 KB
testcase_69 AC 1 ms
6,944 KB
testcase_70 AC 1 ms
6,944 KB
testcase_71 AC 1 ms
6,940 KB
testcase_72 AC 1 ms
6,944 KB
testcase_73 AC 1 ms
6,940 KB
testcase_74 AC 1 ms
6,940 KB
testcase_75 AC 1 ms
6,940 KB
testcase_76 AC 1 ms
6,944 KB
testcase_77 AC 1 ms
6,940 KB
testcase_78 AC 1 ms
6,940 KB
testcase_79 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:19:1: warning: return type defaults to 'int' [-Wimplicit-int]
   19 | main(){
      | ^~~~
main.c: In function 'main':
main.c:55:9: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
   55 |         write(1,wp,wbuf+sizeof wbuf-wp);
      |         ^~~~~
main.c:56:9: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
   56 |         _exit(0);
      |         ^~~~~
      |         _Exit

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

char*mmap();
char wbuf[1<<25];

#define rd_skip() while(*rp++>=48)
#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define rd_signed(v) long v=0;{long _c,_s;_s=*rp=='-'&&++rp;while(_c=*rp++-48,_c>=0)v=v*10+_c;v=_s?-v:v;}
#define wt_signed(v) {long _z=v,_s;_s=_z<0?_z=-_z,1:0;do*--wp=_z%10+48;while(_z/=10);if(_s)*--wp='-';}
#define rep(v,e) for(long v=0;v<e;++v)
#define rrep(v,e) for(long v=e;v--;)
#define chmin(v,a) (v=v<=a?v:a)

long a[100][100];

#define SUP (1ll<<61)

main(){
	rep(i,100){
		rep(j,100){
			a[i][j]=SUP;
		}
	}
	rep(i,100){
		a[i][i]=0;
	}

	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd(n);
	rd_skip();
	while(*rp){
		rd(s); --s;
		rd(t); --t;
		rd_signed(d);
		chmin(a[s][t],d);
	}
	rep(k,n){
		rep(i,n){
			rep(j,n){
				chmin(a[i][j],a[i][k]+a[k][j]);
			}
		}
	}

	char*wp=wbuf+sizeof wbuf;
	rrep(i,n){
		long z=0;
		rrep(j,n){
			z+=a[i][j]<SUP/2?a[i][j]:0;
		}
		*--wp='\n';
		wt_signed(z);
	}
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0