結果

問題 No.1470 Mex Sum
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-09 21:40:42
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 151,964 KB
実行使用メモリ 7,212 KB
最終ジャッジ日時 2023-10-14 18:23:15
合計ジャッジ時間 10,937 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 9 ms
4,352 KB
testcase_03 AC 10 ms
4,352 KB
testcase_04 AC 10 ms
4,356 KB
testcase_05 AC 10 ms
4,356 KB
testcase_06 AC 10 ms
4,348 KB
testcase_07 AC 10 ms
4,352 KB
testcase_08 AC 10 ms
4,348 KB
testcase_09 AC 10 ms
4,348 KB
testcase_10 AC 11 ms
4,352 KB
testcase_11 AC 10 ms
4,348 KB
testcase_12 AC 91 ms
6,960 KB
testcase_13 AC 101 ms
6,672 KB
testcase_14 AC 99 ms
6,944 KB
testcase_15 AC 97 ms
6,836 KB
testcase_16 AC 93 ms
6,704 KB
testcase_17 AC 89 ms
6,728 KB
testcase_18 AC 94 ms
6,908 KB
testcase_19 AC 97 ms
6,696 KB
testcase_20 AC 99 ms
6,724 KB
testcase_21 AC 100 ms
6,948 KB
testcase_22 AC 96 ms
7,044 KB
testcase_23 AC 103 ms
7,212 KB
testcase_24 AC 102 ms
7,108 KB
testcase_25 AC 97 ms
6,984 KB
testcase_26 AC 100 ms
7,108 KB
testcase_27 AC 96 ms
7,012 KB
testcase_28 AC 100 ms
6,844 KB
testcase_29 AC 100 ms
6,988 KB
testcase_30 AC 101 ms
7,096 KB
testcase_31 AC 102 ms
6,800 KB
testcase_32 AC 99 ms
6,936 KB
testcase_33 AC 99 ms
6,936 KB
testcase_34 AC 102 ms
6,796 KB
testcase_35 AC 100 ms
6,884 KB
testcase_36 AC 106 ms
7,052 KB
testcase_37 AC 53 ms
5,020 KB
testcase_38 AC 50 ms
5,008 KB
testcase_39 AC 59 ms
4,992 KB
testcase_40 AC 54 ms
4,876 KB
testcase_41 AC 55 ms
5,012 KB
testcase_42 AC 56 ms
5,012 KB
testcase_43 AC 54 ms
5,088 KB
testcase_44 AC 53 ms
4,908 KB
testcase_45 AC 54 ms
5,016 KB
testcase_46 AC 58 ms
5,144 KB
testcase_47 AC 53 ms
5,004 KB
testcase_48 AC 54 ms
4,924 KB
testcase_49 AC 54 ms
5,036 KB
testcase_50 AC 53 ms
4,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var a: []int :: #[n]int
	var map: dict<int, int> :: #dict<int, int>
	for i(0, n - 1)
		do a[i] :: cui@inputInt()
		do map.add(a[i], map.get(a[i], &) + 1)
	end for
	
	var ans: int :: n * (n - 1) / 2
	var n1: int :: map.get(1, &)
	var n2: int :: map.get(2, &)
	var n3: int :: n - n1 - n2
	do ans :+ n1 * (n1 - 1) / 2
	do ans :+ n1 * n2 * 2
	do ans :+ n1 * n3
	do cui@print("\{ans}\n")
end func
0