結果

問題 No.1016 三目並べ
ユーザー tonegawatonegawa
提出日時 2020-04-03 23:19:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,396 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 93,636 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 04:45:38
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
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, s.size()-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<s.size();i++){
      bool flag = true;
      for(int j=i;j<s.size();j++){
        if(s[j]=='x') {
          flag = false;
          break;
        }
        if(i!=j&&(j-i)%2==0&&s[j]=='o') break;

        if(j==s.size()-1){
          flag = false;
          break;
        }
      }
      f |= flag;
    }
    std::cout << (f?"o":"x") << '\n';
  }
  return 0;
}
0