結果

問題 No.1470 Mex Sum
ユーザー NoneNone
提出日時 2021-10-06 14:52:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 86,628 KB
実行使用メモリ 105,584 KB
最終ジャッジ日時 2023-09-30 08:47:10
合計ジャッジ時間 8,267 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,356 KB
testcase_01 AC 74 ms
71,348 KB
testcase_02 AC 81 ms
76,964 KB
testcase_03 AC 84 ms
76,960 KB
testcase_04 AC 81 ms
77,004 KB
testcase_05 AC 82 ms
76,816 KB
testcase_06 AC 81 ms
77,312 KB
testcase_07 AC 81 ms
76,952 KB
testcase_08 AC 82 ms
77,304 KB
testcase_09 AC 82 ms
77,496 KB
testcase_10 AC 81 ms
77,376 KB
testcase_11 AC 81 ms
76,968 KB
testcase_12 AC 112 ms
105,312 KB
testcase_13 AC 110 ms
105,328 KB
testcase_14 AC 111 ms
105,420 KB
testcase_15 AC 111 ms
105,396 KB
testcase_16 AC 111 ms
105,244 KB
testcase_17 AC 111 ms
105,216 KB
testcase_18 AC 113 ms
105,324 KB
testcase_19 AC 114 ms
105,288 KB
testcase_20 AC 112 ms
105,548 KB
testcase_21 AC 114 ms
105,224 KB
testcase_22 AC 115 ms
105,400 KB
testcase_23 AC 117 ms
105,364 KB
testcase_24 AC 114 ms
105,460 KB
testcase_25 AC 114 ms
105,444 KB
testcase_26 AC 113 ms
105,276 KB
testcase_27 AC 113 ms
105,344 KB
testcase_28 AC 116 ms
105,244 KB
testcase_29 AC 117 ms
105,584 KB
testcase_30 AC 115 ms
105,412 KB
testcase_31 AC 115 ms
105,384 KB
testcase_32 AC 115 ms
105,376 KB
testcase_33 AC 118 ms
105,392 KB
testcase_34 AC 116 ms
105,420 KB
testcase_35 AC 116 ms
105,560 KB
testcase_36 AC 113 ms
105,472 KB
testcase_37 AC 109 ms
104,252 KB
testcase_38 AC 110 ms
104,080 KB
testcase_39 AC 110 ms
104,276 KB
testcase_40 AC 108 ms
104,204 KB
testcase_41 AC 111 ms
104,452 KB
testcase_42 AC 107 ms
104,384 KB
testcase_43 AC 108 ms
104,308 KB
testcase_44 AC 107 ms
104,476 KB
testcase_45 AC 107 ms
104,348 KB
testcase_46 AC 107 ms
104,216 KB
testcase_47 AC 107 ms
104,260 KB
testcase_48 AC 105 ms
104,316 KB
testcase_49 AC 106 ms
104,220 KB
testcase_50 AC 106 ms
104,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
cnt=[0]*4
for a in A:
    if a<=2:
        cnt[a]+=1
    else:
        cnt[3]+=1
res=0
res+=(cnt[2]+cnt[3])*(cnt[2]+cnt[3]-1)//2
res+=2*(cnt[1]*cnt[3]+cnt[1]*(cnt[1]-1)//2)
res+=3*cnt[1]*cnt[2]
print(res)
0