結果

問題 No.794 チーム戦 (2)
ユーザー pazzle1230pazzle1230
提出日時 2019-02-22 21:30:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 1,500 ms
コード長 1,098 bytes
コンパイル時間 1,469 ms
コンパイル使用メモリ 172,168 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-03 23:53:25
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 41 ms
6,944 KB
testcase_15 AC 41 ms
6,944 KB
testcase_16 AC 41 ms
6,940 KB
testcase_17 AC 40 ms
6,940 KB
testcase_18 AC 40 ms
6,940 KB
testcase_19 AC 40 ms
6,940 KB
testcase_20 AC 38 ms
6,940 KB
testcase_21 AC 38 ms
6,940 KB
testcase_22 AC 24 ms
6,940 KB
testcase_23 AC 21 ms
6,948 KB
testcase_24 AC 17 ms
6,944 KB
testcase_25 AC 15 ms
6,940 KB
testcase_26 AC 16 ms
6,940 KB
testcase_27 AC 17 ms
6,940 KB
testcase_28 AC 17 ms
6,940 KB
testcase_29 AC 17 ms
6,948 KB
testcase_30 AC 16 ms
6,940 KB
testcase_31 AC 17 ms
6,940 KB
testcase_32 AC 17 ms
6,940 KB
testcase_33 AC 17 ms
6,940 KB
testcase_34 AC 18 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, K;
	vector<int64> A;
	cin >> N >> K;
	A.resize(N);
	for(auto &x : A) cin >> x;
	sort(all(A));
	int64 r = 0, used = 0;
	int64 res = 1;
	for (int64 i = N-1; i >= 0; i--) {
		while(r <= i && A[r] + A[i] <= K) r++;
		if (r > i) break;
		res *= (r-used);
		res %= mod;
		used++;
	}
	for (int64 i = r-used; i > 0; i-=2) {
		res *= i-1;
		res %= mod;
	}
	cout << res << endl;
}
0