結果

問題 No.1016 三目並べ
ユーザー kozykozy
提出日時 2021-05-09 18:56:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,068 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 11,964 KB
実行使用メモリ 10,312 KB
最終ジャッジ日時 2023-10-19 03:55:35
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,280 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for i in range(T):
  N,S=input().split()
  N=int(N)
  flag=True
  for i in range(N-2):
    if S[i]==S[i+1]==S[i+2]=="o":
      print("O")
      flag=False
      break
    if (S[i]==S[i+1]=="o") and S[i+2]=="-":
      print("O")
      flag=False
      break
    if (S[i]==S[i+2]=="o") and S[i+1]=="-":
      print("O")
      flag=False
      break
    if (S[i+2]==S[i+1]=="o") and S[i]=="-":
      print("O")
      flag=False
      break
    if i!=N-3:
      if (S[i+1]=="o") and S[i]==S[i+2]==S[i+3]=="-":
        print("O")
        flag=False
        break
      if (S[i+2]=="o") and S[i]==S[i+1]==S[i+3]=="-":
        print("O")
        flag=False
        break
  flag2=False
  for i in range(1,N):
    if S[i]=="-":
      if S[i-1]=="o":
        this=1
        flag2=True
    if S[i]=="-" and i!=N-1:
      if S[i+1]=="o" and flag:
        if this%2==1:
          print("O")
          flag=False
          break
        else:
          flag2=False
          this=-1
      elif S[i+1]=="-":
        if flag:
          this+=1
  if flag:
    print("X")
0