結果

問題 No.1470 Mex Sum
ユーザー netyo715netyo715
提出日時 2021-04-09 22:06:12
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 16,744 KB
最終ジャッジ日時 2023-09-07 11:24:56
合計ジャッジ時間 9,081 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,492 KB
testcase_01 AC 19 ms
8,520 KB
testcase_02 AC 33 ms
9,200 KB
testcase_03 AC 35 ms
9,400 KB
testcase_04 AC 34 ms
9,396 KB
testcase_05 AC 34 ms
9,236 KB
testcase_06 AC 34 ms
9,380 KB
testcase_07 AC 34 ms
9,416 KB
testcase_08 AC 34 ms
9,436 KB
testcase_09 AC 34 ms
9,356 KB
testcase_10 AC 35 ms
9,300 KB
testcase_11 AC 33 ms
9,336 KB
testcase_12 AC 164 ms
15,720 KB
testcase_13 AC 160 ms
15,924 KB
testcase_14 AC 165 ms
15,984 KB
testcase_15 AC 164 ms
15,992 KB
testcase_16 AC 161 ms
15,876 KB
testcase_17 AC 159 ms
15,768 KB
testcase_18 AC 158 ms
15,772 KB
testcase_19 AC 162 ms
15,852 KB
testcase_20 AC 159 ms
15,720 KB
testcase_21 AC 164 ms
16,560 KB
testcase_22 AC 167 ms
16,140 KB
testcase_23 AC 165 ms
16,744 KB
testcase_24 AC 169 ms
15,952 KB
testcase_25 AC 165 ms
16,008 KB
testcase_26 AC 167 ms
16,008 KB
testcase_27 AC 164 ms
16,064 KB
testcase_28 AC 169 ms
16,132 KB
testcase_29 AC 165 ms
15,972 KB
testcase_30 AC 166 ms
16,004 KB
testcase_31 AC 167 ms
15,932 KB
testcase_32 AC 167 ms
16,108 KB
testcase_33 AC 166 ms
16,056 KB
testcase_34 AC 169 ms
16,104 KB
testcase_35 AC 165 ms
15,992 KB
testcase_36 AC 167 ms
16,004 KB
testcase_37 AC 154 ms
12,288 KB
testcase_38 AC 154 ms
12,360 KB
testcase_39 AC 153 ms
12,396 KB
testcase_40 AC 154 ms
12,460 KB
testcase_41 AC 154 ms
12,452 KB
testcase_42 AC 155 ms
12,388 KB
testcase_43 AC 154 ms
12,360 KB
testcase_44 AC 156 ms
12,348 KB
testcase_45 AC 154 ms
12,328 KB
testcase_46 AC 155 ms
12,356 KB
testcase_47 AC 156 ms
12,420 KB
testcase_48 AC 155 ms
12,344 KB
testcase_49 AC 154 ms
12,400 KB
testcase_50 AC 154 ms
12,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
ac = Counter()
for a in A:
    ac[min(3, a)] += 1

ans = 0
ans += ((ac[1]**2)-ac[1])//2 * 2
ans += ((ac[2]**2)-ac[2])//2
ans += ((ac[3]**2)-ac[3])//2
ans += ac[1]*ac[2] * 3
ans += ac[1]*ac[3] * 2
ans += ac[2]*ac[3]

print(ans)
0