結果
| 問題 | No.1924 3 color painting on a line |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:45:45 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 361 bytes |
| 記録 | |
| コンパイル時間 | 1,180 ms |
| コンパイル使用メモリ | 95,336 KB |
| 実行使用メモリ | 87,552 KB |
| 最終ジャッジ日時 | 2026-07-11 12:38:08 |
| 合計ジャッジ時間 | 7,212 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 42 |
ソースコード
n = int(input())
s = input().strip()
if n == 0:
print(0)
exit()
runs = []
current = s[0]
runs.append(current)
for c in s[1:]:
if c != runs[-1]:
runs.append(c)
count = 0
for i in range(len(runs) - 2):
if runs[i] == runs[i+2] and runs[i+1] != runs[i]:
count += 1
minimal_operations = len(runs) - count
print(minimal_operations)
gew1fw