結果
問題 | No.1016 三目並べ |
ユーザー |
![]() |
提出日時 | 2025-04-16 00:11:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,183 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 74,624 KB |
最終ジャッジ日時 | 2025-04-16 00:12:52 |
合計ジャッジ時間 | 1,144 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 10 |
ソースコード
T = int(input()) for _ in range(T): N, S = input().split() # Step 1: Check if current S has 'ooo' if 'ooo' in S: print('O') continue # Step 2: Check if any '-' can create 'ooo' when placed step2 = 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': step2 = True break # Check middle if i >= 1 and i < len(S)-1 and S[i-1] == 'o' and S[i+1] == 'o': step2 = True break # Check right two if i < len(S)-2 and S[i+1] == 'o' and S[i+2] == 'o': step2 = True break if step2: print('O') continue # Step 3: Check each triplet for possible future 'ooo' step3 = False for i in range(len(S) - 2): # Current triplet positions i, i+1, i+2 triplet = S[i:i+3] current_o = triplet.count('o') m = triplet.count('-') possible_o = current_o + (m + 1) // 2 if possible_o >= 3: step3 = True break print('O' if step3 else 'X')