結果
問題 | No.794 チーム戦 (2) |
ユーザー | mamekin |
提出日時 | 2019-02-22 21:42:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 98 ms / 1,500 ms |
コード長 | 919 bytes |
コンパイル時間 | 1,174 ms |
コンパイル使用メモリ | 118,776 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 06:30:00 |
合計ジャッジ時間 | 3,681 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <array> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> #include <memory> #include <regex> using namespace std; const int MOD = 1000000007; int main() { 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()); long long ans = 1; int j = 0; for(int i=0; i<n/2; ++i){ while(j < n && a[n-1-i] + a[j] <= k) ++ j; ans *= min(j - i, n - 1 - 2 * i); ans %= MOD; } cout << ans << endl; return 0; }