結果

問題 No.794 チーム戦 (2)
ユーザー pazzle1230pazzle1230
提出日時 2019-02-22 21:30:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 1,500 ms
コード長 1,098 bytes
コンパイル時間 1,803 ms
コンパイル使用メモリ 170,244 KB
実行使用メモリ 4,700 KB
最終ジャッジ日時 2023-08-16 15:42:40
合計ジャッジ時間 4,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 40 ms
4,508 KB
testcase_15 AC 38 ms
4,552 KB
testcase_16 AC 38 ms
4,512 KB
testcase_17 AC 36 ms
4,528 KB
testcase_18 AC 36 ms
4,584 KB
testcase_19 AC 36 ms
4,560 KB
testcase_20 AC 37 ms
4,564 KB
testcase_21 AC 36 ms
4,560 KB
testcase_22 AC 22 ms
4,376 KB
testcase_23 AC 20 ms
4,376 KB
testcase_24 AC 16 ms
4,380 KB
testcase_25 AC 13 ms
4,376 KB
testcase_26 AC 15 ms
4,380 KB
testcase_27 AC 17 ms
4,552 KB
testcase_28 AC 17 ms
4,700 KB
testcase_29 AC 16 ms
4,612 KB
testcase_30 AC 16 ms
4,564 KB
testcase_31 AC 17 ms
4,568 KB
testcase_32 AC 16 ms
4,644 KB
testcase_33 AC 17 ms
4,616 KB
testcase_34 AC 17 ms
4,648 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