結果

問題 No.1470 Mex Sum
ユーザー 👑 H20H20
提出日時 2021-04-09 22:05:22
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 153 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 111,648 KB
最終ジャッジ日時 2023-09-07 11:23:55
合計ジャッジ時間 10,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
71,556 KB
testcase_01 AC 98 ms
71,496 KB
testcase_02 AC 108 ms
77,884 KB
testcase_03 AC 108 ms
77,920 KB
testcase_04 AC 109 ms
78,132 KB
testcase_05 AC 106 ms
77,932 KB
testcase_06 AC 107 ms
78,204 KB
testcase_07 AC 107 ms
77,820 KB
testcase_08 AC 107 ms
78,208 KB
testcase_09 AC 107 ms
78,188 KB
testcase_10 AC 109 ms
78,184 KB
testcase_11 AC 107 ms
78,004 KB
testcase_12 AC 150 ms
110,648 KB
testcase_13 AC 148 ms
110,632 KB
testcase_14 AC 152 ms
110,752 KB
testcase_15 AC 147 ms
110,676 KB
testcase_16 AC 148 ms
110,564 KB
testcase_17 AC 147 ms
110,552 KB
testcase_18 AC 147 ms
110,760 KB
testcase_19 AC 149 ms
110,640 KB
testcase_20 AC 149 ms
110,776 KB
testcase_21 AC 149 ms
110,836 KB
testcase_22 AC 151 ms
111,380 KB
testcase_23 AC 153 ms
111,604 KB
testcase_24 AC 148 ms
110,748 KB
testcase_25 AC 152 ms
111,408 KB
testcase_26 AC 153 ms
110,720 KB
testcase_27 AC 150 ms
110,708 KB
testcase_28 AC 151 ms
111,480 KB
testcase_29 AC 152 ms
110,736 KB
testcase_30 AC 151 ms
110,808 KB
testcase_31 AC 149 ms
110,728 KB
testcase_32 AC 152 ms
111,440 KB
testcase_33 AC 151 ms
111,444 KB
testcase_34 AC 151 ms
111,648 KB
testcase_35 AC 150 ms
110,740 KB
testcase_36 AC 148 ms
111,416 KB
testcase_37 AC 138 ms
105,428 KB
testcase_38 AC 139 ms
105,220 KB
testcase_39 AC 137 ms
105,208 KB
testcase_40 AC 139 ms
105,248 KB
testcase_41 AC 139 ms
105,108 KB
testcase_42 AC 139 ms
105,272 KB
testcase_43 AC 140 ms
105,080 KB
testcase_44 AC 136 ms
105,216 KB
testcase_45 AC 137 ms
105,096 KB
testcase_46 AC 137 ms
105,080 KB
testcase_47 AC 136 ms
105,444 KB
testcase_48 AC 137 ms
105,216 KB
testcase_49 AC 137 ms
105,156 KB
testcase_50 AC 135 ms
105,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
A = list(map(int, input().split())) 
CA = collections.Counter(A)
print( N*(N-1)//2 + CA[1]*(N-CA[1]) + CA[1]*(CA[1]-1)//2 + CA[1]*CA[2])
0