結果
| 問題 |
No.794 チーム戦 (2)
|
| コンテスト | |
| ユーザー |
veqcc
|
| 提出日時 | 2019-02-22 22:26:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 995 bytes |
| コンパイル時間 | 1,047 ms |
| コンパイル使用メモリ | 99,488 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 09:36:40 |
| 合計ジャッジ時間 | 3,457 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 11 |
ソースコード
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;
const ll MOD = 1000000007LL;
int main() {
int n;
ll k;
cin >> n >> k;
vector <ll> a(n);
ll mx = 0LL;
for (int i = 0; i < n; i++) {
cin >> a[i];
mx = max(mx, a[i]);
}
if (mx >= k) {
cout << 0 << "\n";
return 0;
}
sort(a.begin(), a.end());
ll ans = 1LL;
int i;
for (i = 0; i < n/2; i++) {
if (a[n-i-1] * 2 <= k) break;
int idx = lower_bound(a.begin(), a.end(), k - a[n-i-1]+1) - a.begin();
ans = ans * (ll)(idx - i) % MOD;
}
int remain = n - i * 2;
while (remain) {
ans = ans * (remain * (remain - 1) / 2 / (remain / 2)) % MOD;
remain -= 2;
}
cout << ans << "\n";
return 0;
}
veqcc