結果
問題 | No.794 チーム戦 (2) |
ユーザー |
![]() |
提出日時 | 2019-02-22 22:22:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 42 ms / 1,500 ms |
コード長 | 729 bytes |
コンパイル時間 | 1,645 ms |
コンパイル使用メモリ | 170,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 09:22:03 |
合計ジャッジ時間 | 3,480 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h>#define fst(t) std::get<0>(t)#define snd(t) std::get<1>(t)#define thd(t) std::get<2>(t)#define unless(p) if(!(p))#define until(p) while(!(p))using ll = std::int64_t;using P = std::tuple<int,int>;int N, K;int A[200100];int main(){std::cin.tie(nullptr);std::ios::sync_with_stdio(false);std::cin >> N >> K;for(int i=0;i<N;++i){std::cin >> A[i];}std::sort(A, A + N);int cur = 0;ll cnt = 1;constexpr ll MOD = 1'000'000'007;for(int i=N-1;i>=N/2;--i){while(A[cur] + A[i] <= K){cur += 1;}cnt = cnt * std::max(std::min(cur, i) - (N - 1 - i), 0) % MOD;}std::cout << cnt << std::endl;}