結果

問題 No.794 チーム戦 (2)
ユーザー keymoonkeymoon
提出日時 2019-02-22 22:29:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 223 ms / 1,500 ms
コード長 1,471 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 114,920 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-05-04 03:18:37
合計ジャッジ時間 6,311 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
25,588 KB
testcase_01 AC 29 ms
25,392 KB
testcase_02 AC 30 ms
25,376 KB
testcase_03 AC 28 ms
27,248 KB
testcase_04 AC 30 ms
25,268 KB
testcase_05 AC 29 ms
25,260 KB
testcase_06 AC 29 ms
25,504 KB
testcase_07 AC 30 ms
23,212 KB
testcase_08 AC 29 ms
25,248 KB
testcase_09 AC 29 ms
23,344 KB
testcase_10 AC 31 ms
25,376 KB
testcase_11 AC 31 ms
27,288 KB
testcase_12 AC 30 ms
27,384 KB
testcase_13 AC 29 ms
27,256 KB
testcase_14 AC 221 ms
49,920 KB
testcase_15 AC 222 ms
51,968 KB
testcase_16 AC 223 ms
50,172 KB
testcase_17 AC 209 ms
49,792 KB
testcase_18 AC 213 ms
49,788 KB
testcase_19 AC 216 ms
50,040 KB
testcase_20 AC 215 ms
47,864 KB
testcase_21 AC 209 ms
51,964 KB
testcase_22 AC 146 ms
43,904 KB
testcase_23 AC 133 ms
41,360 KB
testcase_24 AC 103 ms
35,260 KB
testcase_25 AC 88 ms
32,504 KB
testcase_26 AC 94 ms
32,680 KB
testcase_27 AC 166 ms
43,252 KB
testcase_28 AC 167 ms
43,120 KB
testcase_29 AC 161 ms
43,112 KB
testcase_30 AC 159 ms
41,332 KB
testcase_31 AC 162 ms
43,244 KB
testcase_32 AC 155 ms
41,200 KB
testcase_33 AC 165 ms
43,256 KB
testcase_34 AC 168 ms
41,076 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