結果

問題 No.1016 三目並べ
ユーザー tonegawatonegawa
提出日時 2020-04-03 23:23:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,396 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 92,760 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 04:55:34
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
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 #

#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
//typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll T;std::cin >> T;

  re(t, T){
    ll n;std::cin >> n;
    string s;std::cin >> s;

    bool f = false;
    re(i, n-2){
      if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='-') f = true;
      if(s[i]=='-'&&s[i+1]=='o'&&s[i+2]=='o') f = true;
      if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='o') f = true;
    }

    for(int i=0;i<n;i++){
      bool flag = true;
      if(s[i]!='o') continue;
      for(int j=i+1;j<n;j++){
        if(s[j]=='x') {
          flag = false;
          break;
        }
        if((j-i)%2==0&&s[j]=='o') break;
        if(j==n-1){
          flag = false;
          break;
        }
      }
      f |= flag;
    }
    std::cout << (f?"O":"X") << '\n';
  }
  return 0;
}
0