結果
| 問題 |
No.1016 三目並べ
|
| ユーザー |
tamato
|
| 提出日時 | 2020-04-03 22:10:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,236 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 82,444 KB |
| 実行使用メモリ | 76,388 KB |
| 最終ジャッジ日時 | 2024-07-03 03:16:28 |
| 合計ジャッジ時間 | 1,408 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 7 |
ソースコード
def main():
import sys
input = sys.stdin.readline
for _ in range(int(input())):
N, line = input().split()
N = int(N)
ans = 'X'
for i in range(N-2):
s = line[i: i+3]
if s == 'ooo' or s == 'oo-' or s == 'o-o' or s == '-oo':
ans = 'O'
for i in range(N-3):
s = line[i: i + 4]
if s == '-o--' or s == '--o-':
ans = 'O'
for i in range(N-4):
s = line[i: i+5]
if s == 'o---o':
ans = 'O'
flg = 0
cnt = 0
for i, s in enumerate(line):
if flg == 0:
if s == '-':
if line[i-1] == 'o':
flg = 1
cnt += 1
elif flg == 1:
if s == '-':
cnt += 1
elif s == 'o':
if cnt & 1:
ans = 'O'
break
else:
flg = 0
cnt = 0
elif s == 'x':
flg = 0
cnt = 0
print(ans)
if __name__ == '__main__':
main()
tamato