結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
kyuridenamida
|
| 提出日時 | 2016-02-12 16:56:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 965 bytes |
| コンパイル時間 | 1,240 ms |
| コンパイル使用メモリ | 159,600 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 04:12:11 |
| 合計ジャッジ時間 | 2,974 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 7 |
コンパイルメッセージ
main.cpp: In function ‘int f(int, int)’:
main.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
43 | }
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++)
#define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++)
#define all(n) (n).begin(),(n).end()
typedef long long ll;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<long long,long long> Pii;
typedef vector<Pii> VPii;
char s[6][6];
int res = 1e9;
int N;
int f(int x,int y){
if( x >= N ) x = 0 , y++;
if( y >= N ){
int r[6] = {};
for(int i = 0 ; i < N ; i++){
for(int j = 0 ; j < N ; j++){
if( s[i][j] == 'o' ) r[i]++;
}
}
int rr = 0;
for(int i = 0 ; i < N ; i++)
if( r[i] > r[0] ) rr++;
res = min(rr+1,res);
return 0;
}
if( s[y][x] == '-' ){
s[y][x] = 'o';
s[x][y] = 'x';
f(x+1,y);
s[y][x] = s[x][y] = '-';
s[y][x] = 'x';
s[x][y] = 'o';
f(x+1,y);
s[y][x] = s[x][y] = '-';
}else{
f(x+1,y);
}
}
int main(){
cin >> N;
rep(i,N)rep(j,N) cin >> s[i][j];
f(0,0);
cout << res << endl;
}
kyuridenamida