結果

問題 No.923 オセロきりきざむたん
ユーザー lumc_
提出日時 2019-09-26 19:59:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,104 bytes
コンパイル時間 1,093 ms
コンパイル使用メモリ 114,072 KB
実行使用メモリ 6,912 KB
最終ジャッジ日時 2024-09-15 02:48:22
合計ジャッジ時間 3,246 ms
ジャッジサーバーID
(参考情報)
judge2 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 51 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#if 0

嘘解法

#endif

// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
#include<chrono>
#include<functional>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  int cnt[2] = {};
  for(auto &e: v) {
    cin >> e;
    for(auto &e2 : e) e2 -= '0', cnt[e2]++;
  }

  int ans = 1;

  // 偏っているほど NO が出やすい乱択 !w

  mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
  auto rd = bind(uniform_real_distribution<double>(), mt);
  double p = double(min(cnt[0], cnt[1])) / (cnt[0] + cnt[1]);
  p *= 2;
  if(p < 0.5) p = p * p;
  else p = 1 - (1 - p) * (1 - p);
  cerr << p << endl;
  ans = rd(mt) < p;

  cout << (ans ? "YES" : "NO") << endl;
  return 0;
}
0