結果

問題 No.1470 Mex Sum
ユーザー MitarushiMitarushi
提出日時 2021-01-07 20:45:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 92,928 KB
最終ジャッジ日時 2024-04-26 13:23:47
合計ジャッジ時間 6,593 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,224 KB
testcase_01 AC 39 ms
52,224 KB
testcase_02 AC 65 ms
73,088 KB
testcase_03 AC 65 ms
73,856 KB
testcase_04 AC 64 ms
73,728 KB
testcase_05 AC 64 ms
73,728 KB
testcase_06 AC 64 ms
73,984 KB
testcase_07 AC 62 ms
73,472 KB
testcase_08 AC 62 ms
73,728 KB
testcase_09 AC 63 ms
73,856 KB
testcase_10 AC 66 ms
74,240 KB
testcase_11 AC 53 ms
73,856 KB
testcase_12 AC 111 ms
92,672 KB
testcase_13 AC 98 ms
92,288 KB
testcase_14 AC 113 ms
92,544 KB
testcase_15 AC 101 ms
92,492 KB
testcase_16 AC 113 ms
92,544 KB
testcase_17 AC 97 ms
92,288 KB
testcase_18 AC 112 ms
92,672 KB
testcase_19 AC 101 ms
92,672 KB
testcase_20 AC 112 ms
92,288 KB
testcase_21 AC 99 ms
92,800 KB
testcase_22 AC 113 ms
92,544 KB
testcase_23 AC 102 ms
92,744 KB
testcase_24 AC 111 ms
92,672 KB
testcase_25 AC 97 ms
92,660 KB
testcase_26 AC 113 ms
92,672 KB
testcase_27 AC 101 ms
92,800 KB
testcase_28 AC 113 ms
92,800 KB
testcase_29 AC 99 ms
92,544 KB
testcase_30 AC 118 ms
92,800 KB
testcase_31 AC 101 ms
92,928 KB
testcase_32 AC 114 ms
92,672 KB
testcase_33 AC 100 ms
92,840 KB
testcase_34 AC 111 ms
92,800 KB
testcase_35 AC 101 ms
92,672 KB
testcase_36 AC 113 ms
92,672 KB
testcase_37 AC 98 ms
91,860 KB
testcase_38 AC 94 ms
91,392 KB
testcase_39 AC 83 ms
91,392 KB
testcase_40 AC 109 ms
91,904 KB
testcase_41 AC 99 ms
91,520 KB
testcase_42 AC 108 ms
91,776 KB
testcase_43 AC 96 ms
91,776 KB
testcase_44 AC 110 ms
91,904 KB
testcase_45 AC 98 ms
91,776 KB
testcase_46 AC 106 ms
91,648 KB
testcase_47 AC 98 ms
91,776 KB
testcase_48 AC 111 ms
91,776 KB
testcase_49 AC 98 ms
91,776 KB
testcase_50 AC 110 ms
91,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]
d = dict()


def mex(x, y):
    a = {x, y}
    i = 1
    while True:
        if i not in a:
            return i
        i += 1


for i in a:
    i = min(i, 3)
    if i in d:
        d[i] += 1
    else:
        d[i] = 1

ans = 0
for x, i in d.items():
    for y, j in d.items():
        ans += i*j*mex(x, y)
for i in a:
    ans -= mex(i, i)
print(ans // 2)
0