結果

問題 No.1470 Mex Sum
ユーザー KudeKude
提出日時 2021-04-09 21:25:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 1,636 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 91,716 KB
最終ジャッジ日時 2023-09-07 09:46:56
合計ジャッジ時間 8,784 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,444 KB
testcase_01 AC 71 ms
71,176 KB
testcase_02 AC 81 ms
76,388 KB
testcase_03 AC 83 ms
76,536 KB
testcase_04 AC 80 ms
76,616 KB
testcase_05 AC 81 ms
76,256 KB
testcase_06 AC 82 ms
76,652 KB
testcase_07 AC 81 ms
76,436 KB
testcase_08 AC 82 ms
76,616 KB
testcase_09 AC 81 ms
76,612 KB
testcase_10 AC 81 ms
76,672 KB
testcase_11 AC 81 ms
76,540 KB
testcase_12 AC 105 ms
91,592 KB
testcase_13 AC 105 ms
91,664 KB
testcase_14 AC 104 ms
91,412 KB
testcase_15 AC 103 ms
91,616 KB
testcase_16 AC 105 ms
91,572 KB
testcase_17 AC 104 ms
91,276 KB
testcase_18 AC 103 ms
91,504 KB
testcase_19 AC 103 ms
91,564 KB
testcase_20 AC 102 ms
91,640 KB
testcase_21 AC 102 ms
91,708 KB
testcase_22 AC 104 ms
91,632 KB
testcase_23 AC 104 ms
91,440 KB
testcase_24 AC 104 ms
91,296 KB
testcase_25 AC 103 ms
91,616 KB
testcase_26 AC 106 ms
91,384 KB
testcase_27 AC 105 ms
91,376 KB
testcase_28 AC 105 ms
91,704 KB
testcase_29 AC 106 ms
91,640 KB
testcase_30 AC 107 ms
91,716 KB
testcase_31 AC 105 ms
91,388 KB
testcase_32 AC 104 ms
91,604 KB
testcase_33 AC 105 ms
91,572 KB
testcase_34 AC 104 ms
91,620 KB
testcase_35 AC 108 ms
91,636 KB
testcase_36 AC 103 ms
91,524 KB
testcase_37 AC 96 ms
90,424 KB
testcase_38 AC 96 ms
90,360 KB
testcase_39 AC 95 ms
90,452 KB
testcase_40 AC 98 ms
90,784 KB
testcase_41 AC 99 ms
90,364 KB
testcase_42 AC 100 ms
90,504 KB
testcase_43 AC 106 ms
90,644 KB
testcase_44 AC 101 ms
90,476 KB
testcase_45 AC 101 ms
90,784 KB
testcase_46 AC 100 ms
90,368 KB
testcase_47 AC 100 ms
90,636 KB
testcase_48 AC 103 ms
90,756 KB
testcase_49 AC 101 ms
90,700 KB
testcase_50 AC 100 ms
90,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c1 = c2 = 0
for a in map(int, input().split()):
    if a == 1:
        c1 += 1
    elif a == 2:
        c2 += 1
ans = n * (n - 1) // 2
ans += c1 * (n - c1) + c1 * (c1 - 1) // 2
ans += c1 * c2
print(ans)
0