結果
| 問題 | No.2055 12x34... |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-18 01:29:22 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 453 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 81,216 KB |
| 実行使用メモリ | 150,632 KB |
| 最終ジャッジ日時 | 2026-10-05 19:37:56 |
| 合計ジャッジ時間 | 7,492 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 41 |
ソースコード
from collections import defaultdict
n = int(input())
A = list(map(int, input().split()))
mod = 998244353
ans = 0
N_cnt = defaultdict(int)
for i in range(n):
a = A[i]
N_cnt[a] += 1
C = [(num, cnt) for num, cnt in N_cnt.items()]
C.sort(key=lambda x: -x[0])
res = 0
ans = 0
for i in range(len(C) - 1):
if C[i][0] - 1 == C[i + 1][0]:
res += C[i][1]
res %= mod
else:
res = 0
ans += res
ans %= mod
print(ans)