結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2020-01-02 14:43:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 621 bytes |
コンパイル時間 | 1,667 ms |
コンパイル使用メモリ | 173,708 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 18:02:45 |
合計ジャッジ時間 | 2,643 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N,i;double g=0,w=0;cin >> N;vector<int> A(N),B(N);for(i=0; i<N; i++)cin >> A.at(i);sort(A.begin(), A.end());for(i=0; i<N; i++)cin >> B.at(i);sort(B.begin(), B.end());do {do {int a=0;for(i=0; i<N; i++)if(A.at(i)>B.at(i))a++;if(a>N/2)w++;g++;} while(next_permutation(B.begin(), B.end()));} while(next_permutation(A.begin(), A.end()));cout << w/g << endl;}