結果
| 問題 | No.1016 三目並べ |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:37:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 923 bytes |
| 記録 | |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 82,896 KB |
| 実行使用メモリ | 76,256 KB |
| 最終ジャッジ日時 | 2025-03-31 17:38:11 |
| 合計ジャッジ時間 | 1,459 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 10 |
ソースコード
T = int(input())
for _ in range(T):
N, S = input().split()
N = int(N)
# Check if current S has 'ooo'
has_ooo = False
for i in range(len(S) - 2):
if S[i] == S[i+1] == S[i+2] == 'o':
has_ooo = True
break
if has_ooo:
print('O')
continue
# Check if any '-' can form 'ooo' when filled by 'o'
possible = False
for i in range(len(S)):
if S[i] == '-':
# Check left two
if i >= 2 and S[i-2] == 'o' and S[i-1] == 'o':
possible = True
break
# Check middle
if i >= 1 and i + 1 < len(S) and S[i-1] == 'o' and S[i+1] == 'o':
possible = True
break
# Check right two
if i + 2 < len(S) and S[i+1] == 'o' and S[i+2] == 'o':
possible = True
break
print('O' if possible else 'X')
lam6er