結果

問題 No.1470 Mex Sum
ユーザー NoneNone
提出日時 2021-10-06 14:52:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 100,096 KB
最終ジャッジ日時 2024-07-23 02:53:10
合計ジャッジ時間 6,607 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,584 KB
testcase_01 AC 41 ms
51,584 KB
testcase_02 AC 49 ms
63,104 KB
testcase_03 AC 48 ms
63,488 KB
testcase_04 AC 45 ms
62,592 KB
testcase_05 AC 46 ms
62,464 KB
testcase_06 AC 45 ms
62,976 KB
testcase_07 AC 46 ms
62,720 KB
testcase_08 AC 46 ms
63,104 KB
testcase_09 AC 47 ms
62,848 KB
testcase_10 AC 45 ms
63,432 KB
testcase_11 AC 48 ms
62,848 KB
testcase_12 AC 82 ms
98,560 KB
testcase_13 AC 79 ms
98,816 KB
testcase_14 AC 79 ms
98,816 KB
testcase_15 AC 78 ms
98,560 KB
testcase_16 AC 77 ms
98,688 KB
testcase_17 AC 80 ms
98,944 KB
testcase_18 AC 78 ms
98,560 KB
testcase_19 AC 80 ms
98,688 KB
testcase_20 AC 77 ms
98,432 KB
testcase_21 AC 78 ms
99,072 KB
testcase_22 AC 79 ms
99,584 KB
testcase_23 AC 81 ms
100,096 KB
testcase_24 AC 79 ms
99,584 KB
testcase_25 AC 78 ms
99,200 KB
testcase_26 AC 81 ms
99,968 KB
testcase_27 AC 79 ms
99,448 KB
testcase_28 AC 78 ms
99,576 KB
testcase_29 AC 80 ms
99,200 KB
testcase_30 AC 82 ms
98,944 KB
testcase_31 AC 82 ms
99,456 KB
testcase_32 AC 83 ms
99,200 KB
testcase_33 AC 78 ms
98,944 KB
testcase_34 AC 80 ms
98,816 KB
testcase_35 AC 80 ms
99,200 KB
testcase_36 AC 80 ms
99,072 KB
testcase_37 AC 74 ms
96,768 KB
testcase_38 AC 76 ms
96,128 KB
testcase_39 AC 72 ms
96,000 KB
testcase_40 AC 74 ms
96,256 KB
testcase_41 AC 73 ms
97,024 KB
testcase_42 AC 74 ms
96,000 KB
testcase_43 AC 74 ms
96,512 KB
testcase_44 AC 74 ms
96,768 KB
testcase_45 AC 76 ms
96,256 KB
testcase_46 AC 74 ms
96,256 KB
testcase_47 AC 73 ms
96,128 KB
testcase_48 AC 75 ms
96,384 KB
testcase_49 AC 75 ms
96,640 KB
testcase_50 AC 75 ms
96,768 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