結果
問題 | No.794 チーム戦 (2) |
ユーザー |
![]() |
提出日時 | 2018-10-06 01:27:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 95 ms / 1,500 ms |
コード長 | 466 bytes |
コンパイル時間 | 1,694 ms |
コンパイル使用メモリ | 196,496 KB |
最終ジャッジ日時 | 2025-01-06 14:21:02 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; using int64 = long long; const int mod = 1e9 + 7; int main() { int N, K, A[200000]; cin >> N >> K; for(int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); int64 ret = 1, ptr = 0, candidate = 0; for(int i = N - 1; i >= N / 2; i--) { while(ptr <= i && A[ptr] + A[i] <= K) { ++ptr; ++candidate; } if(i < ptr) --candidate; (ret *= candidate) %= mod; --candidate; } cout << ret << endl; }