結果

問題 No.1470 Mex Sum
ユーザー MitarushiMitarushi
提出日時 2021-01-07 20:45:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 94,028 KB
最終ジャッジ日時 2023-08-08 21:07:12
合計ジャッジ時間 8,082 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,260 KB
testcase_01 AC 59 ms
71,424 KB
testcase_02 AC 90 ms
77,716 KB
testcase_03 AC 72 ms
77,668 KB
testcase_04 AC 70 ms
77,800 KB
testcase_05 AC 71 ms
77,672 KB
testcase_06 AC 71 ms
77,688 KB
testcase_07 AC 77 ms
77,660 KB
testcase_08 AC 86 ms
77,808 KB
testcase_09 AC 85 ms
77,684 KB
testcase_10 AC 84 ms
77,772 KB
testcase_11 AC 83 ms
77,724 KB
testcase_12 AC 125 ms
93,656 KB
testcase_13 AC 118 ms
93,620 KB
testcase_14 AC 125 ms
93,692 KB
testcase_15 AC 126 ms
93,576 KB
testcase_16 AC 132 ms
93,648 KB
testcase_17 AC 121 ms
93,788 KB
testcase_18 AC 119 ms
93,700 KB
testcase_19 AC 117 ms
93,472 KB
testcase_20 AC 125 ms
93,680 KB
testcase_21 AC 128 ms
93,728 KB
testcase_22 AC 130 ms
93,848 KB
testcase_23 AC 133 ms
94,028 KB
testcase_24 AC 129 ms
93,804 KB
testcase_25 AC 127 ms
93,808 KB
testcase_26 AC 129 ms
93,940 KB
testcase_27 AC 125 ms
93,688 KB
testcase_28 AC 131 ms
93,748 KB
testcase_29 AC 131 ms
93,936 KB
testcase_30 AC 131 ms
93,776 KB
testcase_31 AC 125 ms
93,940 KB
testcase_32 AC 125 ms
93,548 KB
testcase_33 AC 113 ms
93,980 KB
testcase_34 AC 109 ms
93,968 KB
testcase_35 AC 119 ms
93,916 KB
testcase_36 AC 115 ms
93,860 KB
testcase_37 AC 118 ms
92,952 KB
testcase_38 AC 99 ms
92,788 KB
testcase_39 AC 101 ms
92,768 KB
testcase_40 AC 108 ms
93,140 KB
testcase_41 AC 114 ms
93,212 KB
testcase_42 AC 117 ms
93,048 KB
testcase_43 AC 117 ms
93,200 KB
testcase_44 AC 117 ms
92,832 KB
testcase_45 AC 125 ms
92,932 KB
testcase_46 AC 122 ms
93,276 KB
testcase_47 AC 120 ms
93,168 KB
testcase_48 AC 118 ms
93,376 KB
testcase_49 AC 107 ms
93,256 KB
testcase_50 AC 107 ms
93,016 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