結果
問題 |
No.1470 Mex Sum
|
ユーザー |
|
提出日時 | 2021-04-09 21:31:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 802 bytes |
コンパイル時間 | 85 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 19,300 KB |
最終ジャッジ日時 | 2024-06-25 04:17:39 |
合計ジャッジ時間 | 16,132 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 35 RE * 2 |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) INF = float('inf') MOD = 10**9 + 7 def solve(): N = II() A = LI() One = 0 Two = 0 Other = 0 for a in A: if(a==1): One+=1 elif(a==2): Two+=1 else: Other+=1 import math def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) Three = One*Two Second = combinations_count(One, 2) First = (N*(N-1))//2 - Three -Second print(3*Three+2*Second + First) return solve()