結果

問題 No.486 3 Straight Win(3連勝)
コンテスト
ユーザー lam6er
提出日時 2025-03-26 15:43:58
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 379 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 243 ms
コンパイル使用メモリ 95,856 KB
実行使用メモリ 79,124 KB
最終ジャッジ日時 2026-07-07 22:02:49
合計ジャッジ時間 3,387 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

s = input().strip()
current_east = 0
current_west = 0
winner = None

for c in s:
    if c == 'O':
        current_east += 1
        current_west = 0
    else:
        current_west += 1
        current_east = 0
    
    if current_east >= 3 or current_west >= 3:
        winner = 'East' if current_east >= 3 else 'West'
        break

print(winner if winner is not None else 'NA')
0