結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
憩いの場
|
| 提出日時 | 2023-09-07 17:30:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 905 bytes |
| コンパイル時間 | 1,616 ms |
| コンパイル使用メモリ | 169,820 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 11:18:51 |
| 合計ジャッジ時間 | 2,401 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main( void )
{
int N;
cin >> N;
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];
}
vector<int> perm_A( N ), perm_B( N );
iota( perm_A.begin(), perm_A.end(), 0 );
int win_count = 0, game_count = 0;
do
{
iota( perm_B.begin(), perm_B.end(), 0 );
do
{
int tmp = 0;
for( int i = 0; i < N; i++ )
{
if( A[perm_A[i]] > B[perm_B[i]] ) tmp++;
}
if( tmp > N / 2 ) win_count++;
game_count++;
} while ( next_permutation( perm_B.begin(), perm_B.end() ) );
} while ( next_permutation( perm_A.begin(), perm_A.end() ));
cout << ( double )win_count / ( double )game_count << endl;
return 0;
}
憩いの場