結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-11 09:45:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,204 bytes |
| コンパイル時間 | 1,462 ms |
| コンパイル使用メモリ | 76,524 KB |
| 最終ジャッジ日時 | 2025-01-09 17:16:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 WA * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
void solve() {
int n;
std::cin >> n;
std::vector<int> win(n, 0);
std::vector<std::pair<int, int>> ps;
for (int x = 0; x < n; ++x) {
for (int y = 0; y < n; ++y) {
char c;
std::cin >> c;
if (x >= y) continue;
if (c == 'o') {
++win[x];
} else if (c == 'x') {
++win[y];
} else if (c == '-') {
ps.emplace_back(x, y);
}
}
}
int m = ps.size();
int ans = n;
for (int b = 0; b < (1 << m); ++b) {
auto nwin = win;
for (int i = 0; i < m; ++i) {
int x, y;
std::tie(x, y) = ps[i];
if ((b >> i) & 1) {
++nwin[x];
} else {
++nwin[y];
}
}
int cnt = 1;
for (int x = 1; x < n; ++x) {
if (nwin[x] > nwin[0]) ++cnt;
}
ans = std::min(ans, cnt);
}
std::cout << ans << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}