結果

問題 No.133 カードゲーム
ユーザー fumiphysfumiphys
提出日時 2018-08-09 18:02:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,054 bytes
コンパイル時間 1,158 ms
コンパイル使用メモリ 75,264 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 12:32:04
合計ジャッジ時間 2,694 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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