結果

問題 No.794 チーム戦 (2)
ユーザー ahe100ahe100
提出日時 2019-02-23 17:49:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 95 ms / 1,500 ms
コード長 899 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 85,012 KB
実行使用メモリ 6,796 KB
最終ジャッジ日時 2023-08-20 11:53:38
合計ジャッジ時間 3,972 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 95 ms
6,660 KB
testcase_15 AC 95 ms
6,536 KB
testcase_16 AC 95 ms
6,460 KB
testcase_17 AC 95 ms
6,796 KB
testcase_18 AC 93 ms
6,532 KB
testcase_19 AC 95 ms
6,516 KB
testcase_20 AC 95 ms
6,456 KB
testcase_21 AC 93 ms
6,468 KB
testcase_22 AC 58 ms
5,264 KB
testcase_23 AC 51 ms
5,104 KB
testcase_24 AC 41 ms
4,680 KB
testcase_25 AC 35 ms
4,496 KB
testcase_26 AC 39 ms
4,704 KB
testcase_27 AC 38 ms
6,796 KB
testcase_28 AC 38 ms
6,536 KB
testcase_29 AC 38 ms
6,584 KB
testcase_30 AC 38 ms
6,472 KB
testcase_31 AC 37 ms
6,532 KB
testcase_32 AC 37 ms
6,612 KB
testcase_33 AC 38 ms
6,660 KB
testcase_34 AC 37 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<unordered_set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;
ll inf = 1e18;

/*
ソートして尺取
*/

ll n,k,a[200010],b[200010],ans=1,r;

int main(void){
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	//
	sort(a,a+n);
	r=n-1;
	//
	rep(i,n){
		while(r>=0 && a[i]+a[r]>k)r--;
		b[i]=min(r+1,(ll)i);
	}
	// rep(i,n)cout<<b[i]<<endl;
	reg(i,1,n/2){
		ans = (ans * (b[n-i]-(i-1))) % mod;
	}
	cout<<ans<<endl;
	return 0;
}
0