結果

問題 No.1470 Mex Sum
ユーザー pluto77pluto77
提出日時 2021-07-17 10:14:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 170 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 15,740 KB
最終ジャッジ日時 2023-09-21 03:09:33
合計ジャッジ時間 5,310 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,780 KB
testcase_01 AC 15 ms
7,872 KB
testcase_02 AC 21 ms
8,912 KB
testcase_03 AC 22 ms
8,856 KB
testcase_04 AC 22 ms
8,820 KB
testcase_05 AC 21 ms
8,812 KB
testcase_06 AC 21 ms
8,896 KB
testcase_07 AC 21 ms
8,876 KB
testcase_08 AC 21 ms
9,012 KB
testcase_09 AC 22 ms
8,812 KB
testcase_10 AC 21 ms
8,928 KB
testcase_11 AC 21 ms
8,824 KB
testcase_12 AC 79 ms
15,640 KB
testcase_13 AC 79 ms
15,448 KB
testcase_14 AC 79 ms
15,400 KB
testcase_15 AC 79 ms
15,464 KB
testcase_16 AC 78 ms
15,520 KB
testcase_17 AC 77 ms
15,440 KB
testcase_18 AC 77 ms
15,432 KB
testcase_19 AC 78 ms
15,444 KB
testcase_20 AC 78 ms
15,420 KB
testcase_21 AC 79 ms
15,592 KB
testcase_22 AC 80 ms
15,584 KB
testcase_23 AC 80 ms
15,652 KB
testcase_24 AC 80 ms
15,544 KB
testcase_25 AC 80 ms
15,656 KB
testcase_26 AC 80 ms
15,660 KB
testcase_27 AC 81 ms
15,740 KB
testcase_28 AC 80 ms
15,684 KB
testcase_29 AC 80 ms
15,556 KB
testcase_30 AC 80 ms
15,616 KB
testcase_31 AC 80 ms
15,632 KB
testcase_32 AC 81 ms
15,668 KB
testcase_33 AC 81 ms
15,552 KB
testcase_34 AC 81 ms
15,632 KB
testcase_35 AC 80 ms
15,608 KB
testcase_36 AC 80 ms
15,624 KB
testcase_37 AC 53 ms
11,260 KB
testcase_38 AC 53 ms
11,260 KB
testcase_39 AC 55 ms
11,348 KB
testcase_40 AC 60 ms
11,288 KB
testcase_41 AC 61 ms
11,320 KB
testcase_42 AC 62 ms
11,416 KB
testcase_43 AC 60 ms
11,416 KB
testcase_44 AC 60 ms
11,248 KB
testcase_45 AC 60 ms
11,344 KB
testcase_46 AC 60 ms
11,384 KB
testcase_47 AC 60 ms
11,444 KB
testcase_48 AC 61 ms
11,368 KB
testcase_49 AC 60 ms
11,344 KB
testcase_50 AC 60 ms
11,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1470
n=int(input())
a=sorted(map(int,input().split()))
x=a.count(1)
y=a.count(2)
z=n-x-y
res=y*(y-1)//2+y*z+z*(z-1)//2
res+=2*(x*(x-1)//2+x*z)
res+=3*x*y
print(res)
0