結果
| 問題 | No.2055 12x34... |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-18 01:29:22 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 453 bytes |
| 記録 | |
| コンパイル時間 | 398 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 147,968 KB |
| 最終ジャッジ日時 | 2026-05-28 11:59:01 |
| 合計ジャッジ時間 | 6,638 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_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)