結果

問題 No.1470 Mex Sum
ユーザー KudeKude
提出日時 2021-04-09 21:25:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 85,504 KB
最終ジャッジ日時 2024-06-25 04:03:39
合計ジャッジ時間 5,654 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 40 ms
51,584 KB
testcase_02 AC 51 ms
61,824 KB
testcase_03 AC 50 ms
61,824 KB
testcase_04 AC 51 ms
61,952 KB
testcase_05 AC 52 ms
61,952 KB
testcase_06 AC 51 ms
61,824 KB
testcase_07 AC 52 ms
61,696 KB
testcase_08 AC 51 ms
61,696 KB
testcase_09 AC 51 ms
61,952 KB
testcase_10 AC 52 ms
61,952 KB
testcase_11 AC 53 ms
62,336 KB
testcase_12 AC 78 ms
84,480 KB
testcase_13 AC 78 ms
84,864 KB
testcase_14 AC 78 ms
84,608 KB
testcase_15 AC 79 ms
84,480 KB
testcase_16 AC 76 ms
84,224 KB
testcase_17 AC 79 ms
84,992 KB
testcase_18 AC 77 ms
83,968 KB
testcase_19 AC 79 ms
85,120 KB
testcase_20 AC 77 ms
84,864 KB
testcase_21 AC 78 ms
84,992 KB
testcase_22 AC 79 ms
85,120 KB
testcase_23 AC 79 ms
85,248 KB
testcase_24 AC 78 ms
84,864 KB
testcase_25 AC 79 ms
84,736 KB
testcase_26 AC 80 ms
85,248 KB
testcase_27 AC 79 ms
85,120 KB
testcase_28 AC 79 ms
84,864 KB
testcase_29 AC 80 ms
84,864 KB
testcase_30 AC 80 ms
85,504 KB
testcase_31 AC 79 ms
84,608 KB
testcase_32 AC 80 ms
85,120 KB
testcase_33 AC 77 ms
84,608 KB
testcase_34 AC 77 ms
84,992 KB
testcase_35 AC 78 ms
84,480 KB
testcase_36 AC 78 ms
84,864 KB
testcase_37 AC 66 ms
81,152 KB
testcase_38 AC 69 ms
81,152 KB
testcase_39 AC 67 ms
81,152 KB
testcase_40 AC 73 ms
82,432 KB
testcase_41 AC 71 ms
82,176 KB
testcase_42 AC 71 ms
82,048 KB
testcase_43 AC 74 ms
82,432 KB
testcase_44 AC 75 ms
82,432 KB
testcase_45 AC 75 ms
81,920 KB
testcase_46 AC 75 ms
82,560 KB
testcase_47 AC 75 ms
81,792 KB
testcase_48 AC 73 ms
82,176 KB
testcase_49 AC 73 ms
81,792 KB
testcase_50 AC 72 ms
81,536 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