結果

問題 No.1016 三目並べ
ユーザー queeequeee
提出日時 2020-04-03 21:31:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 78,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 00:16:58
合計ジャッジ時間 1,463 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>

using namespace std; typedef long long ll;
typedef pair<int,int> P; const int INF = 1e9+1;
int main() {
  int t; cin>>t;
  for(int i=0;i<t;i++) {
    int n; string s; cin>>n>>s;
    if (n<3) {cout<<"X"<<endl; continue;}
    bool ok=false;
    for(int i=0;i<n;i++) {
      if (i<n-2){
        if (s[i]=='o' && s[i+1]=='o' && s[i+2]=='o') ok=true;
        if (s[i]=='-' && s[i+1]=='o' && s[i+2]=='o') ok=true;
        if (s[i]=='o' && s[i+1]=='-' && s[i+2]=='o') ok=true;
        if (s[i]=='o' && s[i+1]=='o' && s[i+2]=='-') ok=true;
      }
      if (i<n-3){
        if (s[i]=='-' && s[i+1]=='o' && s[i+2]=='-'&& s[i+3]=='-') ok=true;
        if (s[i]=='-' && s[i+1]=='-' && s[i+2]=='o'&& s[i+3]=='-') ok=true;
      }
    }
    if (ok) cout<<"O"<<endl;
    else cout<<"X"<<endl;
  }
}
0