京都大学プログラミングコンテスト2015

Submission #1603832

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int t, a[35][35], b[35][35];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> t;
	vector<string> ans(t);
	FOR(i, t) {
		int n;
		cin >> n;
		FOR(x, n) FOR(y, n) {
			cin >> a[x][y];
			b[x][y] = a[x][y];
		}
		FOR(k, n) FOR(x, n) FOR(y, n) b[x][y] = min(b[x][y], b[x][k]+b[k][y]);
		bool ok = true;
		FOR(x, n) FOR(y, n) {
			if (b[x][y] != a[x][y]) ok = false;
		}
		ans[i] = (ok ? "YES" : "NO");
	}
	FOR(i, t) cout << ans[i] << endl;
	return 0;
}

Submission

Task問題 C - 最短経路
User nameユーザ名 mogura
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 757 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 00_sample.txt,10_random_00.txt,10_random_01.txt,10_random_02.txt,10_random_03.txt,10_random_04.txt,10_random_05.txt,10_random_06.txt,10_random_07.txt,10_random_08.txt,10_random_09.txt,10_random_10.txt,10_random_11.txt,10_random_12.txt,10_random_13.txt,10_random_14.txt,10_random_15.txt,10_random_16.txt,10_random_17.txt,10_random_18.txt,10_random_19.txt,10_random_20.txt,10_random_21.txt,10_random_22.txt,10_random_23.txt,10_random_24.txt,10_random_25.txt,10_random_26.txt,10_random_27.txt,10_random_28.txt,10_random_29.txt,22_random_30.txt,22_random_31.txt,23_coplete_32.txt,23_coplete_33.txt,24_path_34.txt,24_path_35.txt,25_tree_36.txt,25_tree_37.txt,26_noedge_38.txt,27_dot_39.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample.txt WA
10_random_00.txt AC 4 ms 256 KB
10_random_01.txt AC 4 ms 256 KB
10_random_02.txt AC 4 ms 256 KB
10_random_03.txt AC 4 ms 256 KB
10_random_04.txt AC 4 ms 256 KB
10_random_05.txt AC 4 ms 256 KB
10_random_06.txt AC 4 ms 256 KB
10_random_07.txt AC 4 ms 256 KB
10_random_08.txt AC 4 ms 256 KB
10_random_09.txt AC 4 ms 256 KB
10_random_10.txt AC 4 ms 256 KB
10_random_11.txt AC 4 ms 256 KB
10_random_12.txt AC 4 ms 256 KB
10_random_13.txt AC 4 ms 256 KB
10_random_14.txt AC 4 ms 256 KB
10_random_15.txt AC 4 ms 256 KB
10_random_16.txt AC 4 ms 256 KB
10_random_17.txt AC 4 ms 256 KB
10_random_18.txt AC 4 ms 256 KB
10_random_19.txt AC 4 ms 256 KB
10_random_20.txt AC 4 ms 256 KB
10_random_21.txt AC 4 ms 256 KB
10_random_22.txt AC 4 ms 256 KB
10_random_23.txt AC 4 ms 256 KB
10_random_24.txt AC 4 ms 256 KB
10_random_25.txt AC 4 ms 256 KB
10_random_26.txt AC 4 ms 256 KB
10_random_27.txt AC 4 ms 256 KB
10_random_28.txt AC 4 ms 256 KB
10_random_29.txt AC 4 ms 256 KB
22_random_30.txt WA
22_random_31.txt WA
23_coplete_32.txt AC 4 ms 256 KB
23_coplete_33.txt AC 4 ms 256 KB
24_path_34.txt WA
24_path_35.txt WA
25_tree_36.txt WA
25_tree_37.txt WA
26_noedge_38.txt WA
27_dot_39.txt WA