結果
| 問題 | No.3015 右に寄せろ! |
| コンテスト | |
| ユーザー |
高橋ゆに
|
| 提出日時 | 2024-11-18 20:19:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 65,664 KB |
| 最終ジャッジ日時 | 2025-01-25 21:52:29 |
| 合計ジャッジ時間 | 3,448 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 36 |
ソースコード
N = len(S)
cnts = {}
l = 0
cnt = 1
for i in range(N - 1):
if S[i] != S[i + 1]:
cnts[l] = cnt
cnt = 1
l += 1
if i == N - 2:
cnts[l] = 1
else:
cnt += 1
ans = 0
for i in range(l):
if i % 2 == 0:
continue
if cnts[i] >= 2:
ans += (cnts[i] // 2) * cnts[i + 1]
if i + 2 < l:
cnts[i + 2] += (cnts[i] // 2) * 2
print(ans)
高橋ゆに