結果

問題 No.794 チーム戦 (2)
ユーザー dsytk7dsytk7
提出日時 2019-02-23 09:11:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 1,500 ms
コード長 705 bytes
コンパイル時間 1,632 ms
コンパイル使用メモリ 171,016 KB
実行使用メモリ 4,840 KB
最終ジャッジ日時 2023-08-19 02:02:15
合計ジャッジ時間 5,150 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 83 ms
4,544 KB
testcase_15 AC 84 ms
4,544 KB
testcase_16 AC 81 ms
4,660 KB
testcase_17 AC 79 ms
4,624 KB
testcase_18 AC 79 ms
4,840 KB
testcase_19 AC 81 ms
4,488 KB
testcase_20 AC 81 ms
4,580 KB
testcase_21 AC 80 ms
4,536 KB
testcase_22 AC 49 ms
4,376 KB
testcase_23 AC 43 ms
4,380 KB
testcase_24 AC 35 ms
4,376 KB
testcase_25 AC 30 ms
4,380 KB
testcase_26 AC 33 ms
4,376 KB
testcase_27 AC 31 ms
4,544 KB
testcase_28 AC 31 ms
4,644 KB
testcase_29 AC 32 ms
4,640 KB
testcase_30 AC 32 ms
4,488 KB
testcase_31 AC 32 ms
4,632 KB
testcase_32 AC 33 ms
4,628 KB
testcase_33 AC 32 ms
4,524 KB
testcase_34 AC 32 ms
4,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair<ll, ll>;
using namespace std;

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

const ll mod = 1e9 + 7;

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    ll ans = 1, l = 0, cnt = 0;
    for (int r = N-1; r >= N/2; --r) {
        while (l <= r and A[l] + A[r] <= K) {
            l++; cnt++;
        }
        if (r < l) cnt--;
        ans = (ans * cnt) % mod;
        cnt--;
    }
    cout << ans << endl;
}
0