結果

問題 No.794 チーム戦 (2)
ユーザー kotatsugame
提出日時 2019-02-22 22:17:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 69,756 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 09:06:27
合計ジャッジ時間 3,258 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
long ans=1,mod=1e9+7;
int n,k,a[2<<17];
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int id=n-1;
	for(int i=n;i-->n/2;)
	{
		if(id>=i)id=i-1;
		while(id>=0&&a[id]+a[i]>k)id--;
		if(id+1-(n-i-1)>0)ans=ans*(id+1-(n-i-1))%mod;
		else ans=0;
	}
	cout<<ans<<endl;
}
0