結果

問題 No.133 カードゲーム
ユーザー Tatsuro MiyazakiTatsuro Miyazaki
提出日時 2018-11-06 20:44:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,534 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 77,140 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 22:20:02
合計ジャッジ時間 1,217 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<int> A, B;
	rep(i, 0, N) {
		int a;
		cin >> a;
		A.push_back(a);
	}

	rep(i, 0, N) {
		int b;
		cin >> b;
		B.push_back(b);
	}

	vector<int> v1, v2;
	rep(i, 0, N) {
		v1.push_back(i);
		v2.push_back(i);
	}

	int win_A = 0, win_B = 0, draw = 0;

	do {
		int tmp_win_A = 0, tmp_win_B = 0, tmp_draw = 0;
		rep(i, 0, N) {
			if(A[v1[i]] > B[v2[i]]) tmp_win_A++;
			else if(A[v1[i]] < B[v2[i]]) tmp_win_B++;
			else tmp_draw++;
		}
		if(tmp_win_A > tmp_win_B) win_A++;
		else if(tmp_win_A < tmp_win_B) win_B++;
		else draw++;
	} while(next_permutation(v2.begin(), v2.end()));

	double rsl = win_A / (win_A + win_B + draw + 0.0);
	cout << rsl << endl;
}
0