結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2021-02-03 00:57:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 827 bytes |
コンパイル時間 | 706 ms |
コンパイル使用メモリ | 75,544 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 00:00:32 |
合計ジャッジ時間 | 1,506 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
/*** yukicoder No.133*/#include <iostream>#include <vector>#include <algorithm>typedef std::vector<int> VI;int main(){int N, num_win, num_game, each_win;std::cin >> N;VI A(N), B(N);for (int i = 0; i < N; i++) std::cin >> A.at(i);for (int i = 0; i < N; i++) std::cin >> B.at(i);std::sort(A.begin(), A.end());std::sort(B.begin(), B.end());num_win = 0, num_game = 0;do {do {each_win = 0;for (int i = 0; i < N; i++){if (A.at(i) > B.at(i))each_win++;else if (A.at(i) < B.at(i))each_win--;}if (each_win > 0)num_win++;num_game++;} while(std::next_permutation(B.begin(),B.end()));} while(std::next_permutation(A.begin(), A.end()));std::cout << (double)num_win/(double)num_game << "\n";}