結果

問題 No.488 四角関係
ユーザー fal_rndfal_rnd
提出日時 2017-02-28 23:52:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 6,841 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 68,304 KB
最終ジャッジ日時 2023-09-02 18:14:50
合計ジャッジ時間 16,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 192 ms
58,508 KB
testcase_09 AC 127 ms
55,724 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 124 ms
56,076 KB
testcase_16 WA -
testcase_17 AC 117 ms
56,108 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 117 ms
56,088 KB
testcase_22 AC 120 ms
57,852 KB
testcase_23 AC 120 ms
55,596 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class A{
	static Scanner s = new Scanner(System.in);
	static boolean dp[][];
	public static void main(String[] args) {
		int n=s.nextInt(),m=s.nextInt();
		dp = new boolean[n][n];
		for(int i=0;i<n;i++) dp[i][i]=true;
		for(int i=0;i<m;i++) {
			int a=s.nextInt(),b=s.nextInt();
			dp[a][b]=true;
			dp[b][a]=true;
		}

		int result=0;
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				if(dp[i][j])
				for(int k=0;k<n;k++) {
					if(dp[j][k]&&!dp[i][k])
					for(int l=0;l<n;l++) {
						if(dp[k][l]&&dp[l][i]&&!dp[j][l]) {
							result++;
							System.out.printf("%d,%d,%d,%d\n",i,j,k,l);
						}
					}
				}
			}
		}
		System.out.println(result/8);
	}
}
0