結果

問題 No.133 カードゲーム
ユーザー fumiphys
提出日時 2018-08-09 18:02:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,054 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 75,700 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-23 04:51:41
合計ジャッジ時間 1,567 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int n;
vector<int> a;
vector<int> b;

int main(int argc, char const* argv[])
{
	cin >> n;
	for(int i = 0; i < n; i++){
			int aa;
			cin >> aa;
			a.pb(aa);
	}
	for(int i = 0; i < n; i++){
			int bb;
			cin >> bb;
			b.pb(bb);
	}
	int all = 0;
	int win = 0;
	vector<int> ac;
	for(int i = 0; i < n; i++)ac.pb(i);
	do{
			vector<int> bc;
			for(int i = 0; i < n; i++)bc.pb(i);
			do{
					int res = 0;
					for(int i = 0; i < n; i++){
							if(a[ac[i]] > b[bc[i]])res++;
					}
					all++;
					if(res > n - res)win++;
			}while(next_permutation(bc.begin(), bc.end()));
	}while(next_permutation(ac.begin(), ac.end()));
	cout << (double)win / (double)all << endl;
	return 0;
}
0