結果
問題 |
No.2956 Substitute with Average
|
ユーザー |
|
提出日時 | 2024-11-08 21:46:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 300 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 220,292 KB |
最終ジャッジ日時 | 2024-11-08 21:46:39 |
合計ジャッジ時間 | 9,158 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 17 |
ソースコード
n = int(input()) A = list(map(int, input().split())) ans = 0 for t in range(1, 31): B = [a - t for a in A] tot = 0 cnt = {} for b in B: cnt[tot] = cnt.get(tot, 0) + 1 if b == 0: ans += cnt.get(tot, 0) tot += b print(n * (n + 1) // 2 - ans + 1)