結果

問題 No.761 平均値ゲーム
ユーザー firiexpfiriexp
提出日時 2019-12-24 00:23:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 932 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 99,144 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 04:18:00
合計ジャッジ時間 5,428 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <limits>


static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (auto &&i : v) scanf("%lld", &i);
    vector<ll> s(n+1);
    for (int i = 0; i < n; ++i) {
        s[i+1] = s[i] + v[i];
    }
    auto rec = [&](int l, int r, auto &&f) -> int {
        auto mid = lower_bound(v.begin()+l,v.begin()+r, (s[r]-s[l]+r-l-1)/(r-l)) - v.begin();
        if(mid == l || mid == r) return 1;
        if(f(l, mid, f) && f(mid, r, f)) return 0;
        else return 1;
    };
    puts(rec(0, n, rec) ? "First" : "Second");
    return 0;
}
0