結果
問題 |
No.1924 3 color painting on a line
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:17:14 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 303 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 82,780 KB |
実行使用メモリ | 70,232 KB |
最終ジャッジ日時 | 2025-06-12 20:18:53 |
合計ジャッジ時間 | 3,172 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 42 |
ソースコード
n = int(input()) s = input().strip() if n == 0: print(0) exit() color_changes = 0 for i in range(1, n): if s[i] != s[i-1]: color_changes += 1 count = 0 for i in range(2, n): if s[i] == s[i-2] and s[i] != s[i-1]: count += 1 ans = (color_changes + 1) - count print(ans)