結果

問題 No.794 チーム戦 (2)
ユーザー keymoonkeymoon
提出日時 2019-02-22 22:29:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 277 ms / 1,500 ms
コード長 1,471 bytes
コンパイル時間 3,733 ms
コンパイル使用メモリ 108,528 KB
実行使用メモリ 48,548 KB
最終ジャッジ日時 2023-08-16 19:53:20
合計ジャッジ時間 9,740 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,816 KB
testcase_01 AC 65 ms
23,912 KB
testcase_02 AC 64 ms
21,764 KB
testcase_03 AC 63 ms
21,972 KB
testcase_04 AC 64 ms
23,844 KB
testcase_05 AC 64 ms
21,824 KB
testcase_06 AC 64 ms
23,796 KB
testcase_07 AC 64 ms
23,796 KB
testcase_08 AC 64 ms
19,932 KB
testcase_09 AC 63 ms
21,872 KB
testcase_10 AC 64 ms
21,768 KB
testcase_11 AC 64 ms
23,792 KB
testcase_12 AC 64 ms
23,828 KB
testcase_13 AC 64 ms
23,772 KB
testcase_14 AC 277 ms
48,272 KB
testcase_15 AC 275 ms
48,224 KB
testcase_16 AC 273 ms
44,248 KB
testcase_17 AC 257 ms
46,180 KB
testcase_18 AC 263 ms
48,208 KB
testcase_19 AC 263 ms
48,228 KB
testcase_20 AC 263 ms
48,548 KB
testcase_21 AC 262 ms
48,232 KB
testcase_22 AC 187 ms
40,388 KB
testcase_23 AC 178 ms
39,464 KB
testcase_24 AC 143 ms
29,764 KB
testcase_25 AC 133 ms
28,888 KB
testcase_26 AC 142 ms
29,424 KB
testcase_27 AC 224 ms
39,848 KB
testcase_28 AC 222 ms
37,852 KB
testcase_29 AC 214 ms
38,028 KB
testcase_30 AC 209 ms
39,840 KB
testcase_31 AC 211 ms
37,796 KB
testcase_32 AC 209 ms
37,964 KB
testcase_33 AC 217 ms
37,736 KB
testcase_34 AC 217 ms
37,968 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

class P
{
    static void Main()
    {
        var nk = Console.ReadLine().Split().Select(int.Parse).ToList();
        var a = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => x).ToList();
        //なんやこれ DP?
        long res = 1;
        for (int i = 0; i < a.Count / 2; i++)
        {
            int pairMax = nk[1] - a[i];
            int valid = a.Count - 1;
            int invalid = i;
            if (pairMax < a[valid])
            {
                res *= 0;
                break;
            }
            if (a[invalid] <= pairMax)
            {
                res *= a.Count - i * 2 - 1;//自分を除外しないといけないため
                res %= 1000000007;
                continue;
            }

            while (valid - invalid > 1)
            {
                var mid = (valid + invalid) / 2;
                if (a[mid] <= pairMax) valid = mid;
                else invalid = mid;
            }
            if (a.Count - valid <= i)
            {
                res *= 0;
                break;
            }
            res *= (a.Count - valid - i);
            res %= 1000000007;
        }
        Console.WriteLine(res);
    }
}
0