結果

問題 No.761 平均値ゲーム
ユーザー tottoripapertottoripaper
提出日時 2018-12-19 21:43:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 167,640 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 08:08:56
合計ジャッジ時間 5,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 11 ms
6,940 KB
testcase_34 AC 13 ms
6,944 KB
testcase_35 AC 3 ms
6,944 KB
testcase_36 AC 7 ms
6,940 KB
testcase_37 AC 11 ms
6,940 KB
testcase_38 AC 11 ms
6,940 KB
testcase_39 AC 13 ms
6,944 KB
testcase_40 AC 14 ms
6,944 KB
testcase_41 AC 13 ms
6,944 KB
testcase_42 AC 14 ms
6,940 KB
testcase_43 AC 4 ms
6,940 KB
testcase_44 AC 9 ms
6,944 KB
testcase_45 AC 12 ms
6,940 KB
testcase_46 AC 7 ms
6,940 KB
testcase_47 AC 8 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 AC 14 ms
6,940 KB
testcase_50 AC 4 ms
6,940 KB
testcase_51 AC 3 ms
6,944 KB
testcase_52 AC 3 ms
6,944 KB
testcase_53 AC 14 ms
6,944 KB
testcase_54 AC 9 ms
6,948 KB
testcase_55 AC 14 ms
6,940 KB
testcase_56 AC 5 ms
6,944 KB
testcase_57 AC 14 ms
6,944 KB
testcase_58 AC 3 ms
6,940 KB
testcase_59 AC 13 ms
6,940 KB
testcase_60 AC 6 ms
6,948 KB
testcase_61 AC 14 ms
6,944 KB
testcase_62 AC 14 ms
6,944 KB
testcase_63 AC 4 ms
6,948 KB
testcase_64 AC 13 ms
6,944 KB
testcase_65 AC 6 ms
6,944 KB
testcase_66 AC 2 ms
6,940 KB
testcase_67 AC 6 ms
6,944 KB
testcase_68 AC 3 ms
6,940 KB
testcase_69 AC 12 ms
6,940 KB
testcase_70 AC 8 ms
6,940 KB
testcase_71 AC 5 ms
6,940 KB
testcase_72 AC 3 ms
6,940 KB
testcase_73 AC 6 ms
6,944 KB
testcase_74 AC 5 ms
6,940 KB
testcase_75 AC 8 ms
6,944 KB
testcase_76 AC 6 ms
6,944 KB
testcase_77 AC 11 ms
6,940 KB
testcase_78 AC 8 ms
6,944 KB
testcase_79 AC 4 ms
6,944 KB
testcase_80 AC 4 ms
6,944 KB
testcase_81 AC 4 ms
6,940 KB
testcase_82 AC 9 ms
6,940 KB
testcase_83 AC 15 ms
6,944 KB
testcase_84 AC 15 ms
6,940 KB
testcase_85 AC 15 ms
6,940 KB
testcase_86 AC 16 ms
6,940 KB
testcase_87 AC 16 ms
6,948 KB
testcase_88 AC 16 ms
6,940 KB
testcase_89 AC 16 ms
6,944 KB
testcase_90 AC 16 ms
6,944 KB
testcase_91 AC 16 ms
6,940 KB
testcase_92 AC 16 ms
6,940 KB
testcase_93 AC 1 ms
6,944 KB
testcase_94 AC 2 ms
6,940 KB
testcase_95 AC 14 ms
6,944 KB
testcase_96 AC 15 ms
6,940 KB
testcase_97 AC 15 ms
6,940 KB
testcase_98 AC 11 ms
6,944 KB
testcase_99 AC 16 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/string:50,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/locale_classes.h:40,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/ios_base.h:41,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
In static member function 'static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = long long int; bool _IsMove = false]',
    inlined from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:495:30,
    inlined from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:522:42,
    inlined from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:529:31,
    inlined from '_OI std::copy(_II, _II, _OI) [with _II = long long int*; _OI = long long int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

int N;
ll A[100100], B[100100];

bool rec(int l, int r){
    int n = r - l;
    if(n == 0){
        return false;
    }

    ll sum = B[l] - B[r], average = (sum + n - 1) / n;
    int i = std::lower_bound(A, A+N, average) - A;

    return !rec(l, i) || !rec(i, r);
}

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> A[i];
    }

    std::copy(A, A+N, B);
    
    for(int i=N-2;i>=0;--i){
        B[i] += B[i+1];
    }

    bool f = rec(0, N);
    if(f){
        std::cout << "First" << std::endl;
    }else{
        std::cout << "Second" << std::endl;
    }
}
0