結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
eri
|
| 提出日時 | 2015-07-15 02:59:47 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 551 bytes |
| 記録 | |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 85,336 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-11 08:16:11 |
| 合計ジャッジ時間 | 1,126 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(s) s.begin(),s.end()
using namespace std;
int main(void){
int n; cin >> n;
vector<int> a(n), b(n);
REP(i, n){ cin >> a[i]; }
REP(i, n){ cin >> b[i]; }
sort(ALL(a));
int win = 0, total = 0;
do{
sort(ALL(b));
do{
int cnt = 0;
REP(i, n){ (a[i] > b[i]) ? cnt++ : cnt--; }
if (cnt > 0) win++;
total++;
} while (next_permutation(ALL(b)));
} while (next_permutation(ALL(a)));
cout << (double)win / total << endl;
return 0;
}
eri