結果

問題 No.794 チーム戦 (2)
ユーザー 259_Momone259_Momone
提出日時 2019-02-22 21:43:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 103 ms / 1,500 ms
コード長 455 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 162,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 00:54:45
合計ジャッジ時間 3,757 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 101 ms
5,376 KB
testcase_15 AC 98 ms
5,376 KB
testcase_16 AC 99 ms
5,376 KB
testcase_17 AC 103 ms
5,376 KB
testcase_18 AC 92 ms
5,376 KB
testcase_19 AC 91 ms
5,376 KB
testcase_20 AC 91 ms
5,376 KB
testcase_21 AC 92 ms
5,376 KB
testcase_22 AC 59 ms
5,376 KB
testcase_23 AC 57 ms
5,376 KB
testcase_24 AC 42 ms
5,376 KB
testcase_25 AC 34 ms
5,376 KB
testcase_26 AC 37 ms
5,376 KB
testcase_27 AC 37 ms
5,376 KB
testcase_28 AC 37 ms
5,376 KB
testcase_29 AC 39 ms
5,376 KB
testcase_30 AC 40 ms
5,376 KB
testcase_31 AC 38 ms
5,376 KB
testcase_32 AC 39 ms
5,376 KB
testcase_33 AC 38 ms
5,376 KB
testcase_34 AC 37 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    constexpr long M = 1000000007;
    long N, K;
    cin >> N >> K;
    vector<long> A(N);
    for(auto& i : A)cin >> i;
    sort(A.begin(), A.end());
    long ans(1);
    for(long i = 0; i < N; ++i){
        auto k = min<long>(N - i - 1, upper_bound(A.begin(), A.end(), K - A[N - i - 1]) - A.begin());
        if(k - i >= 0)ans = ans * (k - i) % M;
    }
    cout << ans << endl;
    return 0;
}
0