結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-24 11:00:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,393 bytes |
| コンパイル時間 | 833 ms |
| コンパイル使用メモリ | 82,740 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 13:35:30 |
| 合計ジャッジ時間 | 1,188 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 WA * 1 |
ソースコード
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;
char s[100][100];
int o[100];
int main()
{
int n; cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> s[i][j];
if (s[i][j] == 'o')o[i]++;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[i][j] == '#')continue;
if (i == 0) {
if (o[0]+1 >= o[j]) {
if (s[i][j] == '-') {
s[i][j] = 'o';
s[j][i] = 'x';
o[i]++;
}
}
}
else {
if (s[i][j] == '-') {
if ((o[0] >= o[i]+1) || (o[i]+1 <= o[j])) {
s[i][j] = 'o';
s[j][i] = 'x';
o[i]++;
}
else {
s[j][i] = 'o';
s[i][j] = 'x';
o[j]++;
}
}
}
}
}
int ans = 1,score = o[0],rank=1;
sort(o,o+n);
reverse(o, o + n);
for (int i = 0; i < n-1; i++) {
if (o[i] != o[i + 1]) {
if (o[i] == score) {
ans = rank;
break;
}
rank++;
if (o[i + 1] == score) {
ans = rank;
break;
}
}
}
cout << ans << endl;
return 0;
}