結果
問題 |
No.1470 Mex Sum
|
ユーザー |
👑 ![]() |
提出日時 | 2021-04-09 21:26:30 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 344 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 81,928 KB |
実行使用メモリ | 101,164 KB |
最終ジャッジ日時 | 2024-06-25 04:06:51 |
合計ジャッジ時間 | 5,452 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 35 |
ソースコード
""" """ import sys from sys import stdin N = int(stdin.readline()) A = list(map(int,stdin.readline().split())) one = 0 two = 0 for i in A: if i == 2: two += 1 elif i == 1: one += 1 ans = 0 ans += 2 * (one * (one-1)//2) ans += 3 * (one * two) ans += 1 * ( N*(N-1)//2 - one * (one-1)//2 - one * two ) print (ans)