結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-09-24 00:11:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,440 bytes |
コンパイル時間 | 1,957 ms |
コンパイル使用メモリ | 171,700 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 04:43:26 |
合計ジャッジ時間 | 2,766 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; //typedef typedef unsigned int UINT; typedef unsigned long long ULL; typedef long long LL; typedef pair<long long, long long> PLL; typedef tuple<long long, long long, long long> TLL3; typedef tuple<long long, long long, long long, long long> TLL4; typedef set<LL, greater<LL> > setdownLL; #define PQ priority_queue typedef PQ<LL, vector<LL>, greater<LL> > pqupLL; //container utill #define ALL(v) (v).begin(),(v).end() #define CR [](auto element1, auto element2){return element1>element2;} #define LB lower_bound #define UP upper_bound #define PB push_back #define MP make_pair #define MT make_tuple //constant #define PI 3.141592653589793 int main(){ //input int N; cin >> N; int A[N], B[N]; int i; for(i=0; i<N; i++){ cin >> A[i]; } for(i=0; i<N; i++){ cin >> B[i]; } //calc sort(A,A+N); sort(B,B+N); int Awon=0, shobusu=0; int Awonsho, Bwonsho; do{ do{ Awonsho=0, Bwonsho=0; for(i=0; i<N; i++){ if(A[i]>B[i]) Awonsho++; else if(A[i]<B[i]) Bwonsho++; } if(Awonsho>Bwonsho) Awon++; shobusu++; }while(next_permutation(B,B+N)); }while(next_permutation(A,A+N)); long double Awonlb=Awon, shobusulb=shobusu; //output cout << fixed << setprecision(5) << Awonlb/shobusulb << endl; return 0; }