結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
eri
|
| 提出日時 | 2015-07-15 02:59:47 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 249µs | |
| コード長 | 551 bytes |
| 記録 | |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 84,304 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-29 14:45:19 |
| 合計ジャッジ時間 | 1,699 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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