結果

問題 No.761 平均値ゲーム
ユーザー koprickykopricky
提出日時 2018-12-09 09:28:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,927 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 163,452 KB
実行使用メモリ 5,124 KB
最終ジャッジ日時 2023-10-14 14:19:57
合計ジャッジ時間 5,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,352 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 1 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,352 KB
testcase_30 AC 1 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 10 ms
4,432 KB
testcase_34 AC 13 ms
4,772 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 8 ms
4,348 KB
testcase_37 AC 11 ms
4,360 KB
testcase_38 AC 10 ms
4,424 KB
testcase_39 AC 13 ms
4,700 KB
testcase_40 AC 13 ms
4,656 KB
testcase_41 AC 12 ms
4,624 KB
testcase_42 AC 13 ms
4,696 KB
testcase_43 AC 4 ms
4,352 KB
testcase_44 AC 9 ms
4,348 KB
testcase_45 AC 11 ms
4,592 KB
testcase_46 AC 7 ms
4,352 KB
testcase_47 AC 7 ms
4,352 KB
testcase_48 AC 2 ms
4,348 KB
testcase_49 AC 13 ms
4,836 KB
testcase_50 AC 3 ms
4,348 KB
testcase_51 AC 3 ms
4,348 KB
testcase_52 AC 2 ms
4,352 KB
testcase_53 AC 14 ms
4,972 KB
testcase_54 AC 8 ms
4,348 KB
testcase_55 AC 13 ms
4,700 KB
testcase_56 AC 4 ms
4,352 KB
testcase_57 AC 13 ms
4,840 KB
testcase_58 AC 3 ms
4,352 KB
testcase_59 AC 13 ms
4,612 KB
testcase_60 AC 5 ms
4,348 KB
testcase_61 AC 14 ms
4,796 KB
testcase_62 AC 14 ms
4,708 KB
testcase_63 AC 4 ms
4,352 KB
testcase_64 AC 13 ms
4,560 KB
testcase_65 AC 6 ms
4,356 KB
testcase_66 AC 2 ms
4,352 KB
testcase_67 AC 5 ms
4,352 KB
testcase_68 AC 3 ms
4,348 KB
testcase_69 AC 11 ms
4,500 KB
testcase_70 AC 7 ms
4,348 KB
testcase_71 AC 4 ms
4,348 KB
testcase_72 AC 3 ms
4,348 KB
testcase_73 AC 6 ms
4,352 KB
testcase_74 AC 4 ms
4,348 KB
testcase_75 AC 7 ms
4,352 KB
testcase_76 AC 4 ms
4,352 KB
testcase_77 AC 11 ms
4,456 KB
testcase_78 AC 8 ms
4,356 KB
testcase_79 AC 4 ms
4,348 KB
testcase_80 AC 3 ms
4,352 KB
testcase_81 AC 3 ms
4,352 KB
testcase_82 AC 9 ms
4,348 KB
testcase_83 AC 15 ms
5,076 KB
testcase_84 AC 15 ms
5,112 KB
testcase_85 AC 14 ms
4,940 KB
testcase_86 AC 14 ms
4,948 KB
testcase_87 AC 15 ms
5,124 KB
testcase_88 AC 15 ms
4,872 KB
testcase_89 AC 14 ms
5,044 KB
testcase_90 AC 14 ms
4,856 KB
testcase_91 AC 15 ms
4,884 KB
testcase_92 AC 13 ms
4,900 KB
testcase_93 AC 1 ms
4,348 KB
testcase_94 AC 1 ms
4,352 KB
testcase_95 AC 14 ms
5,044 KB
testcase_96 AC 15 ms
4,856 KB
testcase_97 AC 15 ms
4,900 KB
testcase_98 AC 11 ms
4,924 KB
testcase_99 AC 15 ms
4,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<P,int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

long long sm[MAX_N], a[MAX_N];

bool dfs(int l, int r)
{
    if(r-l == 0) return false;
    if(sm[r]-sm[l] == (r-l)*a[l]) return true;
    int ll = l, rr = r-1;
    while(rr-ll > 1){
        int mid = (ll+rr)/2;
        if(sm[r]-sm[l] <= (r-l)*a[mid]){
            rr = mid;
        }else{
            ll = mid;
        }
    }
    return !dfs(l, rr) || !dfs(rr, r);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n){
        cin >> a[i];
        sm[i+1] = sm[i] + a[i];
    }
    if(dfs(0,n)){
        cout << "First\n";
    }else{
        cout << "Second\n";
    }
    return 0;
}
0