結果

問題 No.794 チーム戦 (2)
ユーザー pockynypockyny
提出日時 2019-03-16 06:45:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 96 ms / 1,500 ms
コード長 424 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 69,564 KB
実行使用メモリ 6,680 KB
最終ジャッジ日時 2023-09-14 15:05:39
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 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,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 95 ms
6,536 KB
testcase_15 AC 96 ms
6,580 KB
testcase_16 AC 96 ms
6,680 KB
testcase_17 AC 96 ms
6,532 KB
testcase_18 AC 94 ms
6,500 KB
testcase_19 AC 95 ms
6,656 KB
testcase_20 AC 94 ms
6,464 KB
testcase_21 AC 94 ms
6,400 KB
testcase_22 AC 58 ms
5,424 KB
testcase_23 AC 52 ms
4,992 KB
testcase_24 AC 41 ms
4,764 KB
testcase_25 AC 34 ms
4,652 KB
testcase_26 AC 39 ms
4,520 KB
testcase_27 AC 37 ms
6,484 KB
testcase_28 AC 38 ms
6,468 KB
testcase_29 AC 38 ms
6,504 KB
testcase_30 AC 38 ms
6,528 KB
testcase_31 AC 38 ms
6,404 KB
testcase_32 AC 38 ms
6,496 KB
testcase_33 AC 37 ms
6,512 KB
testcase_34 AC 39 ms
6,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[200010],b[200010],ans = 1,mod = 1000000007;
int main(){
	int i,n,k;
	cin >> n >> k;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a,a + n);
	int j = -1;
	for(i=n-1;i>=0;i--){
		while(a[j+1]+a[i]<=k && j+1<n) j++;
		b[i] = min(i - 1,j) + 1;
	}
	j = 0;
	for(i=n-1;i>=n/2;i--){
		(ans *= (b[i] - j)) %= mod;
		j++;
	}
	cout << ans << endl;
}
0