結果

問題 No.1016 三目並べ
ユーザー rsk0315rsk0315
提出日時 2020-04-03 21:45:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 61,488 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 00:52:08
合計ジャッジ時間 1,054 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#include <string>

bool g(std::string const& s, std::string const& t) {
  return (std::search(s.begin(), s.end(), t.begin(), t.end()) != s.end());
}

char f(std::string const& s) {
  if (g(s, "-o--")) return true;
  if (g(s, "--o-")) return true;
  if (g(s, "-oo")) return true;
  if (g(s, "o-o")) return true;
  if (g(s, "oo-")) return true;
  if (g(s, "ooo")) return true;
  return false;
}

int main() {
  int t;
  scanf("%d", &t);

  while (t--) {
    size_t n;
    char buf[1024];
    scanf("%zu %s", &n, buf);
    std::string s = buf;
    puts(f(s)? "O": "X");
  }
}
0