結果
| 問題 | No.3488 距離の公理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-24 14:20:10 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,601 bytes |
| 記録 | |
| コンパイル時間 | 2,100 ms |
| コンパイル使用メモリ | 336,436 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-24 14:20:15 |
| 合計ジャッジ時間 | 3,274 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
int N;
cin >> N;
vector<vector<int>> D(N, vector<int>(N));
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
cin >> D[i][j];
}
}
bool property1 = true;
bool property2 = true;
bool property3 = true;
bool property4 = true;
// ① 非退化性
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
if(i == j && D[i][j] != 0) property1 = false;
if(i != j && D[i][j] == 0) property1 = false;
}
}
// ② 対称性
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
if(D[i][j] != D[j][i]) property2 = false;
}
}
// ③ 三角不等式
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
for(int k = 0; k < N; k++){
if(D[i][j] > D[i][k] + D[k][j]){
property3 = false;
}
}
}
}
// ④ 強三角不等式
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
for(int k = 0; k < N; k++){
if(D[i][j] > max(D[i][k], D[k][j])){
property4 = false;
}
}
}
}
// 判定
if(property1 && property2 && property3){
cout << "Good" << endl;
} else {
cout << "Not Good" << endl;
}
if(property1 && property2 && property4){
cout << "Super Good" << endl;
} else {
cout << "Not Super Good" << endl;
}
return 0;
}