結果

問題 No.133 カードゲーム
コンテスト
ユーザー dsrkuym
提出日時 2020-03-17 14:11:13
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,497 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 769 ms
コンパイル使用メモリ 99,896 KB
最終ジャッジ日時 2026-05-24 12:02:55
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:19:9: error: 'uint64_t' does not name a type
   19 | typedef uint64_t u64;
      |         ^~~~~~~~
main.cpp:15:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <cstring>
  +++ |+#include <cstdint>
   15 | #include <deque>
main.cpp:21:9: error: 'uint32_t' does not name a type
   21 | typedef uint32_t u32;
      |         ^~~~~~~~
main.cpp:21:9: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
main.cpp:24:16: error: 'u32' was not declared in this scope; did you mean 's32'?
   24 | typedef vector<u32> vu32;
      |                ^~~
      |                s32
main.cpp:24:19: error: template argument 1 is invalid
   24 | typedef vector<u32> vu32;
      |                   ^
main.cpp:24:19: error: template argument 2 is invalid
main.cpp:26:16: error: 'u64' was not declared in this scope; did you mean 's64'?
   26 | typedef vector<u64> vu64;
      |                ^~~
      |                s64
main.cpp:26:19: error: template argument 1 is invalid
   26 | typedef vector<u64> vu64;
      |                   ^
main.cpp:26:19: error: template argument 2 is invalid

ソースコード

diff #
raw source code

#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vs32 a(n);
    vs32 b(n);
    rep (i, n) cin >> a[i];
    rep (i, n) cin >> b[i];

    vs32 va(n);
    vs32 vb(n);
    rep (i, n) va[i] = vb[i] = i;

    int numg = 0;
    int numw = 0;
    do {
        do {
            int sa = 0;
            int sb = 0;
            rep (i, n)
            {
                if (a[va[i]] > b[vb[i]]) ++sa;
                else ++sb;
            }
            if (sa > sb) ++numw;
            ++numg;
        } while (next_permutation(vb.begin(), vb.end()));
    } while (next_permutation(va.begin(), va.end()));


    cout << setprecision(10) << (double)numw / (double)numg << "\n";
    return 0;
}
0