結果

問題 No.1016 三目並べ
ユーザー penguinman_2ndpenguinman_2nd
提出日時 2020-04-03 22:18:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,171 bytes
コンパイル時間 1,603 ms
コンパイル使用メモリ 165,576 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 02:28:05
合計ジャッジ時間 7,106 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
char func(int N,string S){
  rep(j,0,N-2){
    string T=S.substr(j,3);
      if(T=="ooo") return 'O';
      if(T=="-oo"||T=="oo-"||T=="o-o") return 'O';
    }
  rep(i,0,N){
    if(S[i]=='-'){
      S[i]='o';
      int sum=0;
      rep(j,0,N-2){
        string T=S.substr(j,3);
        if(T=="ooo") return 'O';
        if(T=="-oo"||T=="oo-") sum++;
      }
      if(sum>=2) return 'O';
      S[i]='-';
    }
  }
  return 'X';
}
signed main(){
  int T; cin>>T;
  rep(_,0,T){
    int N; string S; cin>>N>>S;
    cout<<func(N,S)<<endl;
  }
  }

0