結果

問題 No.488 四角関係
ユーザー fal_rndfal_rnd
提出日時 2017-02-28 23:52:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 213 ms / 5,000 ms
コード長 693 bytes
コンパイル時間 6,120 ms
コンパイル使用メモリ 78,880 KB
実行使用メモリ 41,696 KB
最終ジャッジ日時 2023-09-02 18:17:16
合計ジャッジ時間 10,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
39,572 KB
testcase_01 AC 189 ms
40,136 KB
testcase_02 AC 171 ms
39,784 KB
testcase_03 AC 150 ms
39,712 KB
testcase_04 AC 164 ms
40,500 KB
testcase_05 AC 196 ms
40,860 KB
testcase_06 AC 149 ms
39,792 KB
testcase_07 AC 213 ms
41,696 KB
testcase_08 AC 202 ms
41,520 KB
testcase_09 AC 121 ms
39,324 KB
testcase_10 AC 139 ms
39,556 KB
testcase_11 AC 133 ms
39,892 KB
testcase_12 AC 147 ms
39,796 KB
testcase_13 AC 139 ms
39,732 KB
testcase_14 AC 131 ms
39,424 KB
testcase_15 AC 119 ms
39,772 KB
testcase_16 AC 123 ms
39,084 KB
testcase_17 AC 121 ms
39,160 KB
testcase_18 AC 125 ms
39,324 KB
testcase_19 AC 126 ms
39,368 KB
testcase_20 AC 120 ms
39,088 KB
testcase_21 AC 121 ms
39,304 KB
testcase_22 AC 124 ms
40,132 KB
testcase_23 AC 120 ms
39,472 KB
testcase_24 AC 124 ms
39,280 KB
権限があれば一括ダウンロードができます

ソースコード

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