結果
| 問題 |
No.794 チーム戦 (2)
|
| コンテスト | |
| ユーザー |
pazzle1230
|
| 提出日時 | 2019-02-22 21:30:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 1,500 ms |
| コード長 | 1,098 bytes |
| コンパイル時間 | 1,441 ms |
| コンパイル使用メモリ | 172,184 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 05:27:17 |
| 合計ジャッジ時間 | 3,189 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;
const double eps = 1e-10;
template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}
const int64 mod = 1e9+7;
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
int64 N, K;
vector<int64> A;
cin >> N >> K;
A.resize(N);
for(auto &x : A) cin >> x;
sort(all(A));
int64 r = 0, used = 0;
int64 res = 1;
for (int64 i = N-1; i >= 0; i--) {
while(r <= i && A[r] + A[i] <= K) r++;
if (r > i) break;
res *= (r-used);
res %= mod;
used++;
}
for (int64 i = r-used; i > 0; i-=2) {
res *= i-1;
res %= mod;
}
cout << res << endl;
}
pazzle1230