結果
| 問題 |
No.43 野球の試合
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-08-04 20:59:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,242 bytes |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 76,192 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 01:19:30 |
| 合計ジャッジ時間 | 1,139 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 5 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:53:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
53 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:56:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
56 | scanf("%s",s[i]);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000000009
#define INF 10000000
#define LLINF 2000000000000000000LL
#define SIZE 10001
int n,point[6];
char s[6][8];
vector<pair<int,int> > vec;
int dfs(int h){
int a,b;
if(h==vec.size()){
int rank=1;
for(int i=1;i<n;i++){
if(point[i]>point[0])
rank++;
}
return rank;
}
point[vec[h].first]++;
a = dfs(h+1);
point[vec[h].first]--;
point[vec[h].second]++;
b = dfs(h+1);
point[vec[h].second]--;
return min(a,b);
}
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s",s[i]);
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(s[i][j]=='-'){
vec.push_back({i,j});
}else if(s[i][j]=='o'){
point[i]++;
}else{
point[j]++;
}
}
}
printf("%d\n",dfs(0));
return 0;
}
goodbaton