結果

問題 No.761 平均値ゲーム
ユーザー nebukuro09nebukuro09
提出日時 2018-12-09 00:42:57
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,001 bytes
コンパイル時間 985 ms
コンパイル使用メモリ 105,688 KB
実行使用メモリ 8,560 KB
最終ジャッジ日時 2023-09-03 21:27:52
合計ジャッジ時間 7,834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 19 ms
6,020 KB
testcase_34 AC 22 ms
6,676 KB
testcase_35 AC 4 ms
4,376 KB
testcase_36 AC 13 ms
5,616 KB
testcase_37 AC 18 ms
5,716 KB
testcase_38 AC 18 ms
5,984 KB
testcase_39 AC 23 ms
6,780 KB
testcase_40 AC 23 ms
6,724 KB
testcase_41 AC 21 ms
6,324 KB
testcase_42 AC 24 ms
6,972 KB
testcase_43 AC 5 ms
5,100 KB
testcase_44 AC 16 ms
5,556 KB
testcase_45 AC 21 ms
6,176 KB
testcase_46 AC 12 ms
5,428 KB
testcase_47 AC 13 ms
5,648 KB
testcase_48 AC 3 ms
4,380 KB
testcase_49 AC 24 ms
6,760 KB
testcase_50 AC 4 ms
4,376 KB
testcase_51 AC 3 ms
4,384 KB
testcase_52 AC 3 ms
4,380 KB
testcase_53 AC 24 ms
6,916 KB
testcase_54 AC 14 ms
5,676 KB
testcase_55 AC 25 ms
7,120 KB
testcase_56 AC 8 ms
4,380 KB
testcase_57 AC 25 ms
7,072 KB
testcase_58 AC 6 ms
5,352 KB
testcase_59 AC 22 ms
6,664 KB
testcase_60 AC 8 ms
4,380 KB
testcase_61 AC 26 ms
7,244 KB
testcase_62 AC 25 ms
6,992 KB
testcase_63 AC 6 ms
5,044 KB
testcase_64 AC 22 ms
6,644 KB
testcase_65 AC 10 ms
5,436 KB
testcase_66 AC 3 ms
4,380 KB
testcase_67 AC 8 ms
4,376 KB
testcase_68 AC 4 ms
4,380 KB
testcase_69 AC 19 ms
6,176 KB
testcase_70 AC 13 ms
5,668 KB
testcase_71 AC 7 ms
5,164 KB
testcase_72 AC 4 ms
4,376 KB
testcase_73 AC 9 ms
5,436 KB
testcase_74 AC 7 ms
5,372 KB
testcase_75 AC 12 ms
5,700 KB
testcase_76 AC 8 ms
4,380 KB
testcase_77 AC 19 ms
6,280 KB
testcase_78 AC 13 ms
5,796 KB
testcase_79 AC 6 ms
4,380 KB
testcase_80 AC 5 ms
4,380 KB
testcase_81 AC 4 ms
4,376 KB
testcase_82 AC 15 ms
5,880 KB
testcase_83 AC 27 ms
7,064 KB
testcase_84 AC 27 ms
8,560 KB
testcase_85 AC 27 ms
7,028 KB
testcase_86 AC 27 ms
7,004 KB
testcase_87 AC 27 ms
7,012 KB
testcase_88 AC 27 ms
7,088 KB
testcase_89 AC 28 ms
7,180 KB
testcase_90 AC 28 ms
7,084 KB
testcase_91 AC 27 ms
6,960 KB
testcase_92 AC 27 ms
6,916 KB
testcase_93 AC 1 ms
4,376 KB
testcase_94 AC 1 ms
4,376 KB
testcase_95 AC 24 ms
6,980 KB
testcase_96 AC 27 ms
6,976 KB
testcase_97 AC 27 ms
6,948 KB
testcase_98 AC 17 ms
6,556 KB
testcase_99 AC 27 ms
7,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto B = new long[](N+1);
    foreach (i; 0..N) B[i+1] = B[i] + A[i];

    bool solve(bool t, int l, int r) {
        if (r == l)
            return t;
        if (A[l] == A[r])
            return t;

        long a = B[r+1] - B[l];
        int hi = r;
        int lo = l - 1;
        while (hi - lo > 1) {
            int mid = (hi + lo) / 2;
            if (A[mid] * (r - l + 1) >= a) {
                hi = mid;
            } else {
                lo = mid;
            }
        }

        if (!t)
            return !(!solve(t^1, l, hi-1) || !solve(t^1, hi, r));
        else
            return solve(t^1, l, hi-1) || solve(t^1, hi, r);
    }

    writeln(solve(0, 0, N-1) ? "Second" : "First");
}
0