結果

問題 No.1470 Mex Sum
ユーザー ああいいああいい
提出日時 2021-12-06 11:01:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,624 KB
実行使用メモリ 15,780 KB
最終ジャッジ日時 2023-09-21 15:06:33
合計ジャッジ時間 5,712 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,832 KB
testcase_01 AC 14 ms
7,824 KB
testcase_02 AC 22 ms
8,932 KB
testcase_03 AC 23 ms
8,952 KB
testcase_04 AC 21 ms
8,868 KB
testcase_05 AC 20 ms
8,984 KB
testcase_06 AC 21 ms
8,880 KB
testcase_07 AC 21 ms
8,824 KB
testcase_08 AC 24 ms
8,920 KB
testcase_09 AC 21 ms
8,988 KB
testcase_10 AC 21 ms
8,816 KB
testcase_11 AC 21 ms
8,976 KB
testcase_12 AC 83 ms
15,592 KB
testcase_13 AC 83 ms
15,512 KB
testcase_14 AC 82 ms
15,520 KB
testcase_15 AC 83 ms
15,640 KB
testcase_16 AC 83 ms
15,460 KB
testcase_17 AC 86 ms
15,452 KB
testcase_18 AC 84 ms
15,332 KB
testcase_19 AC 81 ms
15,460 KB
testcase_20 AC 83 ms
15,444 KB
testcase_21 AC 85 ms
15,636 KB
testcase_22 AC 85 ms
15,672 KB
testcase_23 AC 87 ms
15,684 KB
testcase_24 AC 86 ms
15,544 KB
testcase_25 AC 85 ms
15,608 KB
testcase_26 AC 88 ms
15,620 KB
testcase_27 AC 84 ms
15,640 KB
testcase_28 AC 88 ms
15,688 KB
testcase_29 AC 86 ms
15,600 KB
testcase_30 AC 85 ms
15,600 KB
testcase_31 AC 87 ms
15,704 KB
testcase_32 AC 84 ms
15,612 KB
testcase_33 AC 87 ms
15,604 KB
testcase_34 AC 86 ms
15,776 KB
testcase_35 AC 84 ms
15,532 KB
testcase_36 AC 86 ms
15,780 KB
testcase_37 AC 71 ms
11,312 KB
testcase_38 AC 76 ms
11,364 KB
testcase_39 AC 77 ms
11,272 KB
testcase_40 AC 76 ms
11,276 KB
testcase_41 AC 75 ms
11,464 KB
testcase_42 AC 79 ms
11,376 KB
testcase_43 AC 74 ms
11,268 KB
testcase_44 AC 76 ms
11,364 KB
testcase_45 AC 76 ms
11,416 KB
testcase_46 AC 74 ms
11,392 KB
testcase_47 AC 74 ms
11,412 KB
testcase_48 AC 77 ms
11,360 KB
testcase_49 AC 76 ms
11,276 KB
testcase_50 AC 75 ms
11,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

count1 = 0
count2 = 0
count = 0
for i in A:
    if i == 1:count1 += 1
    elif i == 2:count2 += 1
    else:count += 1
S = count1 * (count1 - 1) + 3 * count1 * count2 + 2 * count1 * count + count2 * (count2 - 1) // 2 + count2 * count + count * (count-1) // 2
print(S)
0