結果

問題 No.1470 Mex Sum
ユーザー da_abda_ab
提出日時 2021-04-13 20:36:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 52,460 KB
最終ジャッジ日時 2023-09-12 12:44:56
合計ジャッジ時間 17,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
44,952 KB
testcase_01 AC 212 ms
44,932 KB
testcase_02 AC 224 ms
45,892 KB
testcase_03 AC 222 ms
45,984 KB
testcase_04 AC 220 ms
46,012 KB
testcase_05 AC 216 ms
45,888 KB
testcase_06 AC 215 ms
45,984 KB
testcase_07 AC 218 ms
45,864 KB
testcase_08 AC 217 ms
45,980 KB
testcase_09 AC 219 ms
45,896 KB
testcase_10 AC 221 ms
45,728 KB
testcase_11 AC 221 ms
45,812 KB
testcase_12 AC 287 ms
52,124 KB
testcase_13 AC 283 ms
52,252 KB
testcase_14 AC 280 ms
51,988 KB
testcase_15 AC 282 ms
52,004 KB
testcase_16 AC 291 ms
52,276 KB
testcase_17 AC 284 ms
51,832 KB
testcase_18 AC 284 ms
51,992 KB
testcase_19 AC 285 ms
52,160 KB
testcase_20 AC 283 ms
51,900 KB
testcase_21 AC 287 ms
51,984 KB
testcase_22 AC 284 ms
52,084 KB
testcase_23 AC 283 ms
52,156 KB
testcase_24 AC 283 ms
52,312 KB
testcase_25 AC 291 ms
52,080 KB
testcase_26 AC 289 ms
52,124 KB
testcase_27 AC 294 ms
52,060 KB
testcase_28 AC 294 ms
52,264 KB
testcase_29 AC 294 ms
52,048 KB
testcase_30 AC 297 ms
52,460 KB
testcase_31 AC 291 ms
52,232 KB
testcase_32 AC 287 ms
52,220 KB
testcase_33 AC 288 ms
52,364 KB
testcase_34 AC 290 ms
52,240 KB
testcase_35 AC 292 ms
52,252 KB
testcase_36 AC 287 ms
51,984 KB
testcase_37 AC 270 ms
48,244 KB
testcase_38 AC 276 ms
48,104 KB
testcase_39 AC 276 ms
48,220 KB
testcase_40 AC 274 ms
48,168 KB
testcase_41 AC 278 ms
48,084 KB
testcase_42 AC 275 ms
47,988 KB
testcase_43 AC 276 ms
48,156 KB
testcase_44 AC 282 ms
47,880 KB
testcase_45 AC 280 ms
48,272 KB
testcase_46 AC 277 ms
48,228 KB
testcase_47 AC 278 ms
48,240 KB
testcase_48 AC 278 ms
47,772 KB
testcase_49 AC 279 ms
48,104 KB
testcase_50 AC 283 ms
48,348 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)+comb(classifiedA[3],2,exact=True)+(classifiedA[2]*classifiedA[3]))
print(sumA)


0