結果

問題 No.2267 群の公理
ユーザー ks2mks2m
提出日時 2023-04-14 21:38:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 78,108 KB
実行使用メモリ 54,620 KB
最終ジャッジ日時 2024-04-18 19:00:22
合計ジャッジ時間 10,741 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
41,576 KB
testcase_01 AC 135 ms
41,660 KB
testcase_02 AC 126 ms
41,516 KB
testcase_03 AC 127 ms
41,176 KB
testcase_04 AC 131 ms
41,184 KB
testcase_05 AC 128 ms
41,136 KB
testcase_06 AC 128 ms
41,348 KB
testcase_07 AC 133 ms
41,704 KB
testcase_08 AC 130 ms
41,488 KB
testcase_09 AC 128 ms
41,304 KB
testcase_10 AC 128 ms
41,372 KB
testcase_11 AC 129 ms
41,296 KB
testcase_12 AC 115 ms
41,604 KB
testcase_13 AC 130 ms
41,604 KB
testcase_14 AC 133 ms
41,312 KB
testcase_15 AC 130 ms
41,392 KB
testcase_16 AC 131 ms
42,044 KB
testcase_17 AC 131 ms
41,468 KB
testcase_18 AC 126 ms
40,020 KB
testcase_19 AC 130 ms
41,496 KB
testcase_20 AC 130 ms
41,552 KB
testcase_21 AC 134 ms
41,436 KB
testcase_22 AC 137 ms
41,328 KB
testcase_23 AC 138 ms
41,180 KB
testcase_24 AC 119 ms
41,364 KB
testcase_25 AC 135 ms
41,516 KB
testcase_26 AC 133 ms
41,624 KB
testcase_27 AC 142 ms
41,748 KB
testcase_28 WA -
testcase_29 AC 145 ms
41,832 KB
testcase_30 AC 142 ms
41,632 KB
testcase_31 AC 150 ms
41,688 KB
testcase_32 AC 147 ms
41,984 KB
testcase_33 AC 162 ms
41,568 KB
testcase_34 AC 153 ms
41,748 KB
testcase_35 AC 168 ms
41,724 KB
testcase_36 AC 171 ms
41,944 KB
testcase_37 AC 170 ms
41,856 KB
testcase_38 AC 171 ms
42,276 KB
testcase_39 AC 178 ms
42,128 KB
testcase_40 AC 175 ms
42,332 KB
testcase_41 AC 175 ms
42,276 KB
testcase_42 AC 174 ms
42,196 KB
testcase_43 AC 172 ms
42,460 KB
testcase_44 AC 183 ms
42,304 KB
testcase_45 AC 181 ms
42,648 KB
testcase_46 WA -
testcase_47 AC 183 ms
42,584 KB
testcase_48 AC 174 ms
42,244 KB
testcase_49 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] a = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		sc.close();

		boolean[] ek = new boolean[n];
		Arrays.fill(ek, true);
		for (int m = 0; m < n; m++) {
			for (int e = 0; e < n; e++) {
				if (a[m][e] == a[e][m] && a[m][e] == m) {
				} else {
					ek[e] = false;
				}
			}
		}
		for (int e = 0; e < n; e++) {
			if (ek[e]) {
				boolean flga = true;
				for (int m = 0; m < n; m++) {
					boolean flg = false;
					for (int i = 0; i < n; i++) {
						if (a[m][i] == a[i][m] && a[m][i] == e) {
							flg = true;
							break;
						}
					}
					if (!flg) {
						flga = false;
						break;
					}
				}
				if (flga) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}
0