結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2020-07-19 20:10:44 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,159 bytes |
コンパイル時間 | 375 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-16 09:48:53 |
合計ジャッジ時間 | 2,668 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 26 |
ソースコード
d = int(input()) a = list(input()) b = list(input()) week = a+b schedule = [] now = 0 for w in week: if w == "o": if now > 0: now += 1 else: schedule.append(now) now = 1 else: if now < 0: now -= 1 else: schedule.append(now) now = -1 schedule.append(now) schedule = schedule[1:] ans = 0 for i,v in enumerate(schedule): if v > 0: continue else: if abs(v) <= d: tmp = abs(v) try: tmp += schedule[i-1] except IndexError: continue try: tmp += schedule[i+1] except IndexError: continue ans = max(ans, tmp) else: tmp = d try: tmp += schedule[i-1] except IndexError: continue ans = max(ans, tmp) tmp = d try: tmp += schedule[i+1] except IndexError: continue ans = max(ans, tmp) if not ans: ans = d print(ans)