結果
| 問題 |
No.794 チーム戦 (2)
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2019-02-22 23:19:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 1,500 ms |
| コード長 | 748 bytes |
| コンパイル時間 | 659 ms |
| コンパイル使用メモリ | 79,076 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-25 22:26:29 |
| 合計ジャッジ時間 | 2,416 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
constexpr int P = 1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
ll r = 1;
int j = 0;
for (int i = n - 1; i >= n / 2; i--) {
for (; j < n; j++) {
if (a[i] + a[j] > k) break;
}
int t = min(i, j) - (n - 1 - i);
if (t <= 0) {
r = 0;
break;
}
r = r * t % P;
}
cout << r << endl;
return 0;
}
merom686