結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:43:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 712 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 82,324 KB |
実行使用メモリ | 53,564 KB |
最終ジャッジ日時 | 2025-06-12 16:44:21 |
合計ジャッジ時間 | 3,073 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 6 |
ソースコード
D = int(input()) line1 = input().strip() line2 = input().strip() mid = line1 + line2 pre = 'x' * (D + 1) post = 'x' * (D + 1) timeline = pre + mid + post def max_consecutive(s): current = 0 max_o = 0 for c in s: if c == 'o': current += 1 if current > max_o: max_o = current else: current = 0 return max_o max_result = 0 for i in range(len(timeline) - D + 1): substring = timeline[i:i+D] if all(c == 'x' for c in substring): new_s = timeline[:i] + 'o' * D + timeline[i+D:] current_max = max_consecutive(new_s) if current_max > max_result: max_result = current_max print(max_result)