結果

問題 No.1470 Mex Sum
ユーザー 小野寺健小野寺健
提出日時 2021-04-24 17:39:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 235 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 10,536 KB
実行使用メモリ 20,012 KB
最終ジャッジ日時 2023-09-17 13:42:06
合計ジャッジ時間 18,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,356 KB
testcase_01 AC 15 ms
7,872 KB
testcase_02 AC 1,340 ms
8,764 KB
testcase_03 AC 1,361 ms
8,916 KB
testcase_04 AC 1,423 ms
8,904 KB
testcase_05 AC 1,379 ms
8,908 KB
testcase_06 AC 1,459 ms
8,920 KB
testcase_07 AC 1,399 ms
8,848 KB
testcase_08 AC 1,428 ms
8,916 KB
testcase_09 AC 1,466 ms
8,896 KB
testcase_10 AC 1,450 ms
8,920 KB
testcase_11 AC 1,380 ms
8,856 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

A.sort()

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

print(n)
0