結果
| 問題 | No.794 チーム戦 (2) |
| コンテスト | |
| ユーザー |
t33f
|
| 提出日時 | 2019-02-22 22:08:40 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 65 ms / 1,500 ms |
| + 603µs | |
| コード長 | 642 bytes |
| 記録 | |
| コンパイル時間 | 443 ms |
| コンパイル使用メモリ | 84,336 KB |
| 実行使用メモリ | 9,920 KB |
| 最終ジャッジ日時 | 2026-11-15 15:10:38 |
| 合計ジャッジ時間 | 3,800 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <algorithm>
#include <iostream>
using namespace std;
constexpr int M = 1000000007;
int main() {
int n, k; cin >> n >> k;
int a[n];for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a+n);
long long ans = 1;
int i = 0, j = n-1;
while (i < j) {
while (i < j && a[i] + a[j] <= k) i++;
if (i < n - j) { cout << 0 << endl; return 0; }
ans = ans * (i - (n - j - 1)) % M;
j--;
// cerr << i << ' ' << j << ' ' << ans << endl;
}
int m = (j + 1 - (n - j - 1)) / 2;
// cerr << m << endl;
while (m > 0) { ans = ans * (2 * m - 1) % M; m--; }
cout << ans << endl;
}
t33f