結果

問題 No.794 チーム戦 (2)
ユーザー pockynypockyny
提出日時 2019-03-16 06:34:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 69,680 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2023-09-14 15:05:29
合計ジャッジ時間 4,287 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 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,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 96 ms
6,360 KB
testcase_17 AC 94 ms
6,396 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 37 ms
6,368 KB
testcase_30 AC 36 ms
6,396 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[200010],b[200010],ans = 1,mod = 10000000007;
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--){
		if(b[i] - j<=0){
			ans = 0;
			break;
		}
		(ans *= (b[i] - j)) %= mod;
		j++;
	}
	cout << ans << endl;
}
0