結果

問題 No.1470 Mex Sum
ユーザー hir355hir355
提出日時 2021-04-09 21:47:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 157 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 104,792 KB
最終ジャッジ日時 2023-09-07 10:43:03
合計ジャッジ時間 7,622 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,244 KB
testcase_01 AC 73 ms
71,024 KB
testcase_02 AC 74 ms
76,044 KB
testcase_03 AC 74 ms
76,208 KB
testcase_04 AC 75 ms
76,648 KB
testcase_05 AC 74 ms
76,020 KB
testcase_06 AC 75 ms
76,360 KB
testcase_07 AC 76 ms
75,952 KB
testcase_08 AC 75 ms
76,508 KB
testcase_09 AC 76 ms
76,516 KB
testcase_10 AC 75 ms
76,312 KB
testcase_11 AC 74 ms
76,276 KB
testcase_12 AC 109 ms
104,792 KB
testcase_13 AC 106 ms
104,300 KB
testcase_14 AC 108 ms
104,316 KB
testcase_15 AC 107 ms
104,416 KB
testcase_16 AC 107 ms
104,364 KB
testcase_17 AC 107 ms
104,176 KB
testcase_18 AC 108 ms
104,212 KB
testcase_19 AC 107 ms
104,304 KB
testcase_20 AC 108 ms
104,156 KB
testcase_21 AC 107 ms
104,384 KB
testcase_22 AC 109 ms
104,428 KB
testcase_23 AC 107 ms
104,428 KB
testcase_24 AC 108 ms
104,620 KB
testcase_25 AC 105 ms
104,596 KB
testcase_26 AC 106 ms
104,548 KB
testcase_27 AC 106 ms
104,460 KB
testcase_28 AC 106 ms
104,724 KB
testcase_29 AC 107 ms
104,684 KB
testcase_30 AC 108 ms
104,460 KB
testcase_31 AC 108 ms
104,648 KB
testcase_32 AC 107 ms
104,420 KB
testcase_33 AC 106 ms
104,420 KB
testcase_34 AC 107 ms
104,708 KB
testcase_35 AC 107 ms
104,692 KB
testcase_36 AC 107 ms
104,508 KB
testcase_37 AC 99 ms
103,784 KB
testcase_38 AC 102 ms
103,568 KB
testcase_39 AC 101 ms
103,832 KB
testcase_40 AC 103 ms
103,352 KB
testcase_41 AC 103 ms
103,672 KB
testcase_42 AC 103 ms
103,572 KB
testcase_43 AC 107 ms
103,768 KB
testcase_44 AC 102 ms
103,500 KB
testcase_45 AC 106 ms
103,424 KB
testcase_46 AC 103 ms
103,672 KB
testcase_47 AC 104 ms
103,352 KB
testcase_48 AC 102 ms
103,704 KB
testcase_49 AC 103 ms
103,832 KB
testcase_50 AC 105 ms
103,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
p = a.count(1)
q = a.count(2)
ans = n * (n - 1) // 2 + p * (n - 1) - p * (p - 1) // 2 + p * q
print(ans)
0