結果

問題 No.133 カードゲーム
ユーザー zeke
提出日時 2019-11-11 19:37:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 2,775 bytes
コンパイル時間 941 ms
コンパイル使用メモリ 101,696 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 05:21:36
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

/*
Author:zeke
pass System Test!
GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define Icin(s) ll (s);cin>>(s);
#define Scin(s) ll (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
//
struct BipartiteMatching {
vector< vector< int > > graph;
vector< int > match, alive, used;
int timestamp;
BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}
void add_edge(int u, int v) {
graph[u].push_back(v);
graph[v].push_back(u);
}
bool dfs(int idx) {
used[idx] = timestamp;
for(auto &to : graph[idx]) {
int to_match = match[to];
if(alive[to] == 0) continue;
if(to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
match[idx] = to;
match[to] = idx;
return true;
}
}
return false;
}
int bipartite_matching() {
int ret = 0;
for(int i = 0; i < graph.size(); i++) {
if(alive[i] == 0) continue;
if(match[i] == -1) {
++timestamp;
ret += dfs(i);
}
}
return ret;
}
void output() {
for(int i = 0; i < graph.size(); i++) {
if(i < match[i]) {
cout << i << "-" << match[i] << endl;
}
}
}
};
//BipartiteMatching(n) n
//add_edge(s,t)
//bipartite_matching()
int main() {
int n;cin>>n;
V vec1(n);
rep(i,n)cin>>vec1[i];
V vec2(n);
rep(i,n)cin>>vec2[i];
sort(all(vec1));
sort(all(vec2));
ld c=0;
int k=0;
do{
sort(all(vec1));
do{
k++;
int s=0;
int e=0;
rep(i,n){
if(vec1[i]>vec2[i])s++;
else e++;
}
if(s>e)c++;
}while(next_permutation(all(vec1)));
}while(next_permutation(all(vec2)));
cout<<setprecision(20)<<(ld)c/k<<endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0