結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-23 21:57:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,806 bytes |
| コンパイル時間 | 1,695 ms |
| コンパイル使用メモリ | 169,232 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 00:37:11 |
| 合計ジャッジ時間 | 2,475 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl
int gcd(int x, int y){
if ((x==1)||(y==1)) {
return 1;
}
if (x>y) {
if (x%y==0) {
return y;
}else{
return gcd(y, x%y);
}
}else{
if (y%x==0) {
return x;
}else{
return gcd(x, y%x);
}
}
}
int main() {
IN(int, n);
vector<int> a(n);
vector<int> b(n);
REP(i, n){
cin >> a[i];
}
REP(i, n){
cin >> b[i];
}
double totalWin = 0;
double total = 0;
do {
do {
int win = 0;
int lose = 0;
REP(i, n){
if (a[i] > b[i]) {
win++;
}else{
lose++;
}
}
if (win > lose) {
totalWin++;
}
total++;
} while (next_permutation(ALL(b)));
} while (next_permutation(ALL(a)));
COUT(totalWin);
COUT(total);
cout << fixed << setprecision(10) << totalWin/total << endl;
}