結果
問題 | No.2956 Substitute with Average |
ユーザー |
|
提出日時 | 2025-02-03 08:07:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 244 bytes |
コンパイル時間 | 1,470 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 80,128 KB |
最終ジャッジ日時 | 2025-02-03 08:07:53 |
合計ジャッジ時間 | 4,993 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 18 |
ソースコード
N = int(input()) A = [0]+list(map(int,input().split())) cnt = 1 def f(n): return (n*(n-1))//2 ans = f(N)+1 for i in range(2,N+1): if A[i]==A[i-1]: cnt += 1 else: ans -= f(cnt) cnt = 1 ans -= f(cnt) print(ans)