結果

問題 No.1016 三目並べ
ユーザー kozykozy
提出日時 2021-05-09 18:59:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,106 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 10,272 KB
最終ジャッジ日時 2023-10-19 03:57:30
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 33 ms
10,252 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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]!="-":
      flag2=False
    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 flag2:
        if this%2==1:
          print("O")
          flag=False
          break
        else:
          flag2=False
          this=-1
      elif S[i+1]=="-":
        if flag2:
          this+=1
  if flag:
    print("X")
0