結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
youmei
|
| 提出日時 | 2020-08-02 15:46:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 863 bytes |
| コンパイル時間 | 1,775 ms |
| コンパイル使用メモリ | 169,564 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 15:19:51 |
| 合計ジャッジ時間 | 2,276 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()
using namespace std;
using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;
const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;
int main(){
int N; cin >> N;
vi a(N), b(N);
for(auto &x : a) cin >> x;
for(auto &x : b) cin >> x;
vi ord1(N), ord2(N);
for(int i=0; i<N; i++){
ord1[i]=i;
ord2[i]=i;
}
int cnt=0, win=0;
do{
do{
cnt++;
int k=0;
for(int i=0; i<N; i++){
if(a[ord1[i]] > b[ord2[i]]) k++;
}
if(k > N-k) win++;
}while(next_permutation(all(ord2)));
}while(next_permutation(all(ord1)));
cout << fixed << setprecision(4) << (double)win/cnt << endl;
return 0;
}
youmei