結果

問題 No.43 野球の試合
ユーザー utouto97utouto97
提出日時 2019-03-19 14:50:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,060 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 150,448 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 21:05:26
合計ジャッジ時間 2,245 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
  int n;
  cin >> n;
  
  string s[n];
  rep(i, n) cin >> s[i];

  int m = n*(n-1)/2;
  int ans = inf;
  rep(msk, 1<<m){
    int cnt = 0;
    vi win(n);
    rep(i, n) rep(j, i){
      if(s[i][j] == 'o'){
        win[i]++; 
      }else if(s[i][j] == 'x'){
        win[j]++;
      }else{
        if(msk & 1<<cnt){
          win[i]++;  
        }else{
          win[j]++;
        }
      }
      cnt++;
    }

    int t = win[0], res = 1;
    sort(all(win));
    reverse(all(win));
    rep(i, n){
      if(win[i] == t) break;
      res++;
    }

    ans = min(ans, res);
  }

  cout << ans << endl;

  return 0;
}
0