結果

問題 No.794 チーム戦 (2)
ユーザー 259_Momone259_Momone
提出日時 2019-02-22 21:43:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 98 ms / 1,500 ms
コード長 455 bytes
コンパイル時間 2,839 ms
コンパイル使用メモリ 149,172 KB
実行使用メモリ 4,756 KB
最終ジャッジ日時 2023-08-16 17:05:19
合計ジャッジ時間 4,387 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 98 ms
4,564 KB
testcase_15 AC 98 ms
4,672 KB
testcase_16 AC 98 ms
4,636 KB
testcase_17 AC 98 ms
4,648 KB
testcase_18 AC 94 ms
4,652 KB
testcase_19 AC 93 ms
4,752 KB
testcase_20 AC 94 ms
4,580 KB
testcase_21 AC 93 ms
4,728 KB
testcase_22 AC 59 ms
4,376 KB
testcase_23 AC 54 ms
4,380 KB
testcase_24 AC 41 ms
4,376 KB
testcase_25 AC 35 ms
4,376 KB
testcase_26 AC 39 ms
4,380 KB
testcase_27 AC 37 ms
4,612 KB
testcase_28 AC 38 ms
4,656 KB
testcase_29 AC 37 ms
4,732 KB
testcase_30 AC 37 ms
4,612 KB
testcase_31 AC 39 ms
4,640 KB
testcase_32 AC 38 ms
4,756 KB
testcase_33 AC 38 ms
4,612 KB
testcase_34 AC 38 ms
4,640 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