結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2021-12-27 15:40:06 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 2,112 bytes |
コンパイル時間 | 4,013 ms |
コンパイル使用メモリ | 163,600 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 09:12:11 |
合計ジャッジ時間 | 5,012 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>//#include<boost/multiprecision/cpp_int.hpp>//#include <atcoder/all>using namespace std;//using namespace boost::multiprecision;//using namespace atcoder;#define rep(i,n) for(int i=0;i<(n);++i)#define lep(i,n) for(long long i=0;i<(n);++i)#define all(x) (x).begin(),(x).end()#define rall(x) (x).rbegin(),(x).rend()#define equals(a,b) (fabs((a)-(b))<eps)#define fi first#define se second#define pb push_back#define mp make_pair#define sz(x) (int)(x).size()using ll=long long;template<typename T> using vc = vector<T>;template<typename T,typename U> using pp=pair<T,U>;template<typename T> using PQ = priority_queue<T,vc<T>,greater<T>>;using vi=vc<int> ;using vvi=vc<vi>;using vvvi=vc<vvi>;using vl=vc<ll>;using vvl=vc<vl>;using vvvl=vc<vvl>;using pi=pp<int,int>;using pd=pp<double,double>;using pl=pp<ll,ll>;using pip=pp<int,pi>;using vpi=vc<pi>;using vvpi=vc<vpi>;using vs=vc<string>;using vss=vc<vs>;using vst=vc<set<int>>;const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};const int inf=1001001001;const ll infl=100100100100100100;const double eps=(1e-10);const ll mod=1000000007;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }template<typename T>void rprint(T &a) {printf("%.10f\n",a);}template<typename T>void coutarray(vc<T>& v) { rep(i, sz(v)) {cout << " "; cout << v[i];} cout << endl; }template<typename T>void coutmatrix(vc<vc<T>>& v) { rep(i,sz(v)) { rep(j, sz(v[i])) {cout << " "; cout << v[i][j]; } cout << "\n";} };int main(){int n;cin>>n;vi a(n);rep(i,n)cin>>a[i];vi b(n);rep(i,n)cin>>b[i];sort(all(b));sort(all(a));int test=0;int kati=0;do{do{test++;int akati=0,bkati=0;rep(i,n){if(a[i]>b[i])akati++;if(a[i]<b[i])bkati++;}if(akati>bkati)kati++;}while(next_permutation(all(b)));}while(next_permutation(all(a)));double ans=(double)kati/test;rprint(ans);return 0;}