結果

問題 No.794 チーム戦 (2)
ユーザー yumakmcyumakmc
提出日時 2019-02-22 21:45:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,125 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 164,432 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 01:01:47
合計ジャッジ時間 4,127 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 103 ms
6,944 KB
testcase_17 AC 102 ms
6,940 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 38 ms
6,944 KB
testcase_30 AC 38 ms
6,940 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;
long long int mod=1e9+7;
pair<long long int, long long int>mul(
	pair<long long int, long long int>&l,
	pair<long long int, long long int>&r) {
	auto p=make_pair(l.first*r.first,l.second*r.first+r.second);
	return make_pair(p.first%mod,p.second%mod);
}


pair<long long int,long long int> solve(pair<long long int,long long int> a, long long int b) {
	pair<long long int,long long int>answer(1,0);
	if(b==0)return answer;
	if (b % 2) {
		answer=a;
	}
	auto x=solve(a,b/2);
	x=mul(x,x);
	answer=mul(answer,x);

	return answer;
}
int main() {
	int N,K;cin>>N>>K;
	vector<int>v(N);
	for(int i=0;i<N;++i)cin>>v[i];
	sort(v.begin(),v.end());
	long long int answer=1;
	int rest=-1;
	for (int i = N - 1; i >= 0; --i) {
		auto it=upper_bound(v.begin(),v.end(),K-v[i]);
		int num=it-v.begin();
		if (num >= i+1) {
			rest=N-2*(N-1-i);
			break;
		}
		num-=(N-1-i);
		if(num<0)num=0;
		answer*=num;
		answer%=static_cast<int>(1e9+7);
	}
	if (rest != -1) {
		rest--;
		while (rest > 0) {
			answer*=rest;
			rest-=2;
		}
	}
	cout<<answer<<endl;
   return 0;
}
0