結果
| 問題 |
No.118 門松列(2)
|
| ユーザー |
もちふわゆるゆる
|
| 提出日時 | 2023-09-10 01:31:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 531 bytes |
| コンパイル時間 | 390 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 89,472 KB |
| 最終ジャッジ日時 | 2024-06-27 17:38:58 |
| 合計ジャッジ時間 | 3,675 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 22 |
ソースコード
import sys, math
input = lambda: sys.stdin.readline()[:-1]
def MI(): return map(int, input().split())
inf = 10**18
mod = 10**9+7
from itertools import *
def lcom(s):
grouped = groupby(s)
res = []
for k, v in grouped:
res.append((k, int(len(list(v)))))
return res
n = int(input())
a = list(MI())
b = lcom(a)
b1, b3 = 0, 0
for _, i in b:
b3 += i
b3 -= b[0][1]
ans = 0
for b2 in range(1, len(b)):
b1 += b[b2-1][1]
b3 -= b[b2][1]
ans += b[b2][1] * b1 * b3 % mod
ans %= mod
print(ans%mod)
もちふわゆるゆる