結果

問題 No.1470 Mex Sum
ユーザー 小野寺健小野寺健
提出日時 2021-04-24 17:43:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 15,700 KB
最終ジャッジ日時 2023-09-17 13:42:15
合計ジャッジ時間 7,740 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,916 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 AC 28 ms
8,876 KB
testcase_03 AC 28 ms
8,796 KB
testcase_04 AC 29 ms
8,872 KB
testcase_05 AC 28 ms
8,852 KB
testcase_06 AC 28 ms
8,852 KB
testcase_07 AC 27 ms
8,864 KB
testcase_08 AC 28 ms
8,928 KB
testcase_09 AC 28 ms
8,856 KB
testcase_10 AC 28 ms
9,008 KB
testcase_11 AC 27 ms
8,864 KB
testcase_12 AC 141 ms
15,488 KB
testcase_13 AC 139 ms
15,416 KB
testcase_14 AC 138 ms
15,424 KB
testcase_15 AC 140 ms
15,580 KB
testcase_16 AC 142 ms
15,480 KB
testcase_17 AC 136 ms
15,456 KB
testcase_18 AC 138 ms
15,308 KB
testcase_19 AC 137 ms
15,396 KB
testcase_20 AC 138 ms
15,552 KB
testcase_21 AC 145 ms
15,512 KB
testcase_22 AC 142 ms
15,700 KB
testcase_23 AC 144 ms
15,620 KB
testcase_24 AC 144 ms
15,536 KB
testcase_25 AC 142 ms
15,672 KB
testcase_26 AC 145 ms
15,552 KB
testcase_27 AC 142 ms
15,628 KB
testcase_28 AC 142 ms
15,572 KB
testcase_29 AC 147 ms
15,624 KB
testcase_30 AC 149 ms
15,540 KB
testcase_31 AC 141 ms
15,656 KB
testcase_32 AC 142 ms
15,548 KB
testcase_33 AC 141 ms
15,600 KB
testcase_34 AC 142 ms
15,528 KB
testcase_35 AC 146 ms
15,668 KB
testcase_36 AC 143 ms
15,568 KB
testcase_37 AC 132 ms
11,364 KB
testcase_38 AC 98 ms
11,360 KB
testcase_39 AC 103 ms
11,296 KB
testcase_40 AC 127 ms
11,476 KB
testcase_41 AC 124 ms
11,256 KB
testcase_42 AC 123 ms
11,372 KB
testcase_43 AC 127 ms
11,208 KB
testcase_44 AC 127 ms
11,372 KB
testcase_45 AC 125 ms
11,312 KB
testcase_46 AC 125 ms
11,324 KB
testcase_47 AC 126 ms
11,332 KB
testcase_48 AC 126 ms
11,376 KB
testcase_49 AC 129 ms
11,272 KB
testcase_50 AC 124 ms
11,260 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