結果
問題 | No.1016 三目並べ |
ユーザー | 👑 tamato |
提出日時 | 2020-04-03 22:12:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 1,242 bytes |
コンパイル時間 | 334 ms |
コンパイル使用メモリ | 87,080 KB |
実行使用メモリ | 76,760 KB |
最終ジャッジ日時 | 2023-09-16 02:08:46 |
合計ジャッジ時間 | 1,933 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,416 KB |
testcase_01 | AC | 70 ms
71,408 KB |
testcase_02 | AC | 69 ms
71,392 KB |
testcase_03 | AC | 68 ms
71,264 KB |
testcase_04 | AC | 69 ms
71,228 KB |
testcase_05 | AC | 70 ms
71,404 KB |
testcase_06 | AC | 69 ms
71,536 KB |
testcase_07 | AC | 89 ms
76,604 KB |
testcase_08 | AC | 90 ms
76,760 KB |
testcase_09 | AC | 93 ms
76,656 KB |
testcase_10 | AC | 90 ms
76,544 KB |
ソースコード
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 == '-' and i: 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()