結果

問題 No.1470 Mex Sum
ユーザー wolgnikwolgnik
提出日時 2021-04-09 21:29:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 104,220 KB
最終ジャッジ日時 2023-09-07 09:55:38
合計ジャッジ時間 7,678 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,168 KB
testcase_01 AC 72 ms
71,468 KB
testcase_02 AC 77 ms
76,216 KB
testcase_03 AC 76 ms
76,388 KB
testcase_04 AC 78 ms
76,632 KB
testcase_05 AC 75 ms
76,288 KB
testcase_06 AC 77 ms
76,836 KB
testcase_07 AC 78 ms
76,196 KB
testcase_08 AC 78 ms
76,568 KB
testcase_09 AC 77 ms
76,568 KB
testcase_10 AC 77 ms
76,644 KB
testcase_11 AC 76 ms
76,120 KB
testcase_12 AC 109 ms
103,840 KB
testcase_13 AC 110 ms
103,852 KB
testcase_14 AC 111 ms
103,884 KB
testcase_15 AC 111 ms
103,892 KB
testcase_16 AC 113 ms
103,804 KB
testcase_17 AC 111 ms
103,876 KB
testcase_18 AC 110 ms
103,800 KB
testcase_19 AC 110 ms
103,884 KB
testcase_20 AC 109 ms
103,720 KB
testcase_21 AC 109 ms
103,992 KB
testcase_22 AC 108 ms
104,028 KB
testcase_23 AC 110 ms
104,052 KB
testcase_24 AC 110 ms
103,968 KB
testcase_25 AC 112 ms
103,916 KB
testcase_26 AC 111 ms
103,960 KB
testcase_27 AC 112 ms
104,112 KB
testcase_28 AC 112 ms
103,868 KB
testcase_29 AC 111 ms
103,944 KB
testcase_30 AC 110 ms
103,848 KB
testcase_31 AC 111 ms
103,912 KB
testcase_32 AC 112 ms
103,928 KB
testcase_33 AC 111 ms
103,880 KB
testcase_34 AC 111 ms
103,940 KB
testcase_35 AC 110 ms
104,220 KB
testcase_36 AC 109 ms
103,948 KB
testcase_37 AC 105 ms
103,416 KB
testcase_38 AC 107 ms
103,300 KB
testcase_39 AC 108 ms
103,416 KB
testcase_40 AC 109 ms
103,324 KB
testcase_41 AC 110 ms
103,280 KB
testcase_42 AC 109 ms
103,372 KB
testcase_43 AC 110 ms
103,340 KB
testcase_44 AC 113 ms
103,248 KB
testcase_45 AC 110 ms
103,336 KB
testcase_46 AC 108 ms
103,252 KB
testcase_47 AC 109 ms
103,348 KB
testcase_48 AC 106 ms
103,384 KB
testcase_49 AC 109 ms
103,244 KB
testcase_50 AC 108 ms
103,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
other = N - one - two

print(two * (two - 1) // 2 + other * (other - 1) // 2 + two * other + one * (one - 1) + one * other * 2 + one * two * 3)
0