結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2015-07-15 02:59:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 551 bytes |
コンパイル時間 | 541 ms |
コンパイル使用メモリ | 65,452 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 03:33:56 |
合計ジャッジ時間 | 1,269 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;}