結果

問題 No.488 四角関係
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-05 22:59:21
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 2,431 ms
コンパイル使用メモリ 154,592 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-14 18:18:56
合計ジャッジ時間 3,972 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,368 KB
testcase_01 AC 8 ms
4,368 KB
testcase_02 AC 5 ms
4,368 KB
testcase_03 AC 3 ms
4,368 KB
testcase_04 AC 5 ms
4,372 KB
testcase_05 AC 9 ms
4,372 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 AC 23 ms
4,372 KB
testcase_08 AC 86 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 3 ms
4,368 KB
testcase_11 AC 2 ms
4,368 KB
testcase_12 AC 3 ms
4,372 KB
testcase_13 AC 3 ms
4,372 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 AC 2 ms
4,372 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 2 ms
4,368 KB
testcase_18 AC 2 ms
4,368 KB
testcase_19 AC 2 ms
4,372 KB
testcase_20 AC 2 ms
4,372 KB
testcase_21 AC 2 ms
4,368 KB
testcase_22 AC 2 ms
4,368 KB
testcase_23 AC 2 ms
4,368 KB
testcase_24 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var m: int :: cui@inputInt()
	var a: []int :: #[m]int
	var b: []int :: #[m]int
	var map: dict<int, bool> :: #dict<int, bool>
	for i(0, m - 1)
		do a[i] :: cui@inputInt()
		do b[i] :: cui@inputInt()
		do map.add(a[i] * n + b[i], true)
		do map.add(b[i] * n + a[i], true)
	end for
	var ans: int :: 0
	for i(0, m - 1)
		for j(i + 1, m - 1)
			if(a[j] = a[i] | a[j] = b[i] | b[j] = a[i] | b[j] = b[i])
				skip j
			end if
			var straight1: bool :: map.get(a[i] * n + a[j], &)
			var straight2: bool :: map.get(b[i] * n + b[j], &)
			var cross1: bool :: map.get(a[i] * n + b[j], &)
			var cross2: bool :: map.get(b[i] * n + a[j], &)
			if(straight1 & straight2 & !cross1 & !cross2 | !straight1 & !straight2 & cross1 & cross2)
				do ans :+ 1
			end if
		end for
	end for
	do ans :/ 2
	do cui@print("\{ans}\n")
end func
0