結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2020-03-11 18:37:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 67,400 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 00:21:13 |
合計ジャッジ時間 | 1,401 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <iostream>#include <algorithm>using namespace std;int main(){int p[] = {0,1,2,3};int N , A[4], B[4];cin >> N;for(int i=0; i<N; i++){cin >> A[i];}for(int i=0; i<N; i++){cin >> B[i];}int total = 0;int tawin = 0;do{total++;int awin=0, bwin=0;for(int i=0; i<N; i++){if(A[i] > B[p[i]]){awin++;} else {bwin++;}}if(awin > bwin){tawin ++;}}while(next_permutation(p, p+N));cout << (double)tawin / (double)total << endl;return 0;}