結果

問題 No.1470 Mex Sum
ユーザー da_abda_ab
提出日時 2021-04-13 20:23:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 52,432 KB
最終ジャッジ日時 2023-09-12 12:37:47
合計ジャッジ時間 20,769 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
44,980 KB
testcase_01 AC 211 ms
44,876 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 264 ms
47,936 KB
testcase_38 AC 273 ms
48,156 KB
testcase_39 WA -
testcase_40 AC 275 ms
48,320 KB
testcase_41 AC 276 ms
48,148 KB
testcase_42 AC 276 ms
47,960 KB
testcase_43 AC 279 ms
48,028 KB
testcase_44 AC 277 ms
48,296 KB
testcase_45 AC 280 ms
47,856 KB
testcase_46 AC 277 ms
48,140 KB
testcase_47 AC 279 ms
47,876 KB
testcase_48 AC 278 ms
48,000 KB
testcase_49 AC 281 ms
47,940 KB
testcase_50 AC 282 ms
48,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 1470 Mex Sum

from scipy.special import comb
from sys import stdin

n=int(stdin.readline())
a=tuple(map(int,stdin.readline().split()))

classifiedA=[0]*(3+1)
for e in a:
    if e==1:
        classifiedA[1]+=1
    elif e==2:
        classifiedA[2]+=1
    else:
        classifiedA[3]+=1
        
sumA=0
sumA+=3*classifiedA[1]*classifiedA[2]
sumA+=2*(comb(classifiedA[1],2,exact=True)+(classifiedA[1]*classifiedA[3]))
sumA+=1*(comb(classifiedA[2],2,exact=True)+(classifiedA[2]*classifiedA[3]))
print(sumA)


0