結果

問題 No.1470 Mex Sum
ユーザー 小野寺健小野寺健
提出日時 2021-04-24 17:43:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,872 KB
最終ジャッジ日時 2024-07-04 09:09:53
合計ジャッジ時間 8,747 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 29 ms
10,496 KB
testcase_02 AC 41 ms
11,392 KB
testcase_03 AC 39 ms
11,392 KB
testcase_04 AC 41 ms
11,520 KB
testcase_05 AC 41 ms
11,392 KB
testcase_06 AC 45 ms
11,392 KB
testcase_07 AC 41 ms
11,520 KB
testcase_08 AC 41 ms
11,392 KB
testcase_09 AC 41 ms
11,392 KB
testcase_10 AC 40 ms
11,392 KB
testcase_11 AC 40 ms
11,392 KB
testcase_12 AC 164 ms
17,988 KB
testcase_13 AC 163 ms
18,152 KB
testcase_14 AC 165 ms
18,156 KB
testcase_15 AC 165 ms
18,212 KB
testcase_16 AC 164 ms
18,132 KB
testcase_17 AC 157 ms
17,820 KB
testcase_18 AC 157 ms
17,792 KB
testcase_19 AC 161 ms
18,136 KB
testcase_20 AC 161 ms
17,736 KB
testcase_21 AC 172 ms
18,792 KB
testcase_22 AC 169 ms
18,288 KB
testcase_23 AC 169 ms
18,872 KB
testcase_24 AC 169 ms
18,356 KB
testcase_25 AC 164 ms
18,408 KB
testcase_26 AC 169 ms
18,364 KB
testcase_27 AC 174 ms
18,264 KB
testcase_28 AC 170 ms
18,292 KB
testcase_29 AC 166 ms
18,400 KB
testcase_30 AC 169 ms
18,268 KB
testcase_31 AC 171 ms
18,272 KB
testcase_32 AC 176 ms
18,148 KB
testcase_33 AC 174 ms
18,284 KB
testcase_34 AC 170 ms
18,300 KB
testcase_35 AC 172 ms
18,228 KB
testcase_36 AC 171 ms
18,424 KB
testcase_37 AC 161 ms
14,588 KB
testcase_38 AC 117 ms
14,716 KB
testcase_39 AC 122 ms
14,720 KB
testcase_40 AC 153 ms
14,592 KB
testcase_41 AC 152 ms
14,588 KB
testcase_42 AC 155 ms
14,844 KB
testcase_43 AC 153 ms
14,720 KB
testcase_44 AC 149 ms
14,588 KB
testcase_45 AC 155 ms
14,592 KB
testcase_46 AC 156 ms
14,716 KB
testcase_47 AC 152 ms
14,592 KB
testcase_48 AC 147 ms
14,592 KB
testcase_49 AC 148 ms
14,596 KB
testcase_50 AC 157 ms
14,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

A.sort()

n = 0
cnt2 = A.count(2)
for i in range(N):
    if A[i] > 1:
        n += N-1-i
    else:
        cnt = N-1-i-cnt2
        n += 3 * cnt2 + 2 * cnt

print(n)
0