結果

問題 No.1470 Mex Sum
ユーザー titiatitia
提出日時 2021-04-10 00:14:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 16,300 KB
最終ジャッジ日時 2023-09-07 19:13:46
合計ジャッジ時間 5,895 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,476 KB
testcase_01 AC 19 ms
8,440 KB
testcase_02 AC 23 ms
9,304 KB
testcase_03 AC 23 ms
9,284 KB
testcase_04 AC 24 ms
9,280 KB
testcase_05 AC 23 ms
9,248 KB
testcase_06 AC 24 ms
9,352 KB
testcase_07 AC 24 ms
9,204 KB
testcase_08 AC 24 ms
9,196 KB
testcase_09 AC 23 ms
9,300 KB
testcase_10 AC 24 ms
9,296 KB
testcase_11 AC 25 ms
9,332 KB
testcase_12 AC 77 ms
16,268 KB
testcase_13 AC 74 ms
16,072 KB
testcase_14 AC 76 ms
16,088 KB
testcase_15 AC 75 ms
16,120 KB
testcase_16 AC 73 ms
15,740 KB
testcase_17 AC 72 ms
15,892 KB
testcase_18 AC 73 ms
15,912 KB
testcase_19 AC 73 ms
15,852 KB
testcase_20 AC 73 ms
16,040 KB
testcase_21 AC 76 ms
16,088 KB
testcase_22 AC 76 ms
16,196 KB
testcase_23 AC 76 ms
16,288 KB
testcase_24 AC 76 ms
16,168 KB
testcase_25 AC 75 ms
16,256 KB
testcase_26 AC 75 ms
16,300 KB
testcase_27 AC 75 ms
16,108 KB
testcase_28 AC 77 ms
16,268 KB
testcase_29 AC 75 ms
16,292 KB
testcase_30 AC 77 ms
16,156 KB
testcase_31 AC 75 ms
16,240 KB
testcase_32 AC 78 ms
16,124 KB
testcase_33 AC 77 ms
16,256 KB
testcase_34 AC 76 ms
16,196 KB
testcase_35 AC 75 ms
16,224 KB
testcase_36 AC 76 ms
16,276 KB
testcase_37 AC 63 ms
11,760 KB
testcase_38 AC 63 ms
11,808 KB
testcase_39 AC 62 ms
11,776 KB
testcase_40 AC 62 ms
11,792 KB
testcase_41 AC 62 ms
11,664 KB
testcase_42 AC 62 ms
11,808 KB
testcase_43 AC 63 ms
11,696 KB
testcase_44 AC 63 ms
11,732 KB
testcase_45 AC 63 ms
11,852 KB
testcase_46 AC 62 ms
11,732 KB
testcase_47 AC 64 ms
11,756 KB
testcase_48 AC 65 ms
11,632 KB
testcase_49 AC 63 ms
11,760 KB
testcase_50 AC 64 ms
11,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import Counter

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

C=Counter(A)

ONE=C[1]
TWO=C[2]

ANS=N*(N-1)//2
ANS+=ONE*(N-1)-ONE*(ONE-1)//2
ANS+=ONE*TWO

print(ANS)
0