結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2019-02-11 13:58:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 715 bytes |
| コンパイル時間 | 1,379 ms |
| コンパイル使用メモリ | 163,316 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 09:15:01 |
| 合計ジャッジ時間 | 1,946 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define int long long
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
using namespace std;
const int INF=1e9+7;
signed main(){
int N;cin>>N;
std::vector<int> a(N),b(N);
for(int i=0;i<N;i++)cin>>a[i];
for(int i=0;i<N;i++)cin>>b[i];
sort(a.begin(),a.end());
sort(b.begin(),b.end());
double ans=0;double k=0;
do{
do{
int A,B;A=B=0;k++;
for(int i=0;i<N;i++){
if(a[i]<b[i])B++;
if(a[i]>b[i])A++;
}
//cout<<A<<" "<<B<<endl;
if(A>B)ans++;
}while(next_permutation(a.begin(),a.end()));
}while(next_permutation(b.begin(),b.end()));
cout<<ans/k<<endl;
}
cureskol