結果

問題 No.794 チーム戦 (2)
ユーザー どららどらら
提出日時 2019-02-22 23:55:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 98 ms / 1,500 ms
コード長 740 bytes
コンパイル時間 1,699 ms
コンパイル使用メモリ 171,484 KB
実行使用メモリ 5,388 KB
最終ジャッジ日時 2023-08-17 08:17:02
合計ジャッジ時間 4,533 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 98 ms
5,108 KB
testcase_15 AC 98 ms
5,388 KB
testcase_16 AC 98 ms
5,140 KB
testcase_17 AC 98 ms
5,188 KB
testcase_18 AC 95 ms
5,136 KB
testcase_19 AC 95 ms
5,088 KB
testcase_20 AC 95 ms
5,072 KB
testcase_21 AC 95 ms
5,224 KB
testcase_22 AC 59 ms
4,380 KB
testcase_23 AC 53 ms
4,376 KB
testcase_24 AC 41 ms
4,376 KB
testcase_25 AC 35 ms
4,380 KB
testcase_26 AC 40 ms
4,380 KB
testcase_27 AC 37 ms
5,260 KB
testcase_28 AC 38 ms
5,072 KB
testcase_29 AC 38 ms
5,084 KB
testcase_30 AC 36 ms
5,084 KB
testcase_31 AC 38 ms
5,156 KB
testcase_32 AC 37 ms
5,084 KB
testcase_33 AC 38 ms
5,112 KB
testcase_34 AC 37 ms
5,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1000000007LL;

int main(){
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  sort(ALLOF(v));

  ll ret = 1;
  ll cnt = 0;
  for(int i=N-1; i>=N/2; i--){
    auto iter = upper_bound(ALLOF(v), K-v[i]);
    int j = iter - v.begin();
    if(j >= i) j = max(0,i);
    ret *= max(0LL, j - cnt);
    ret %= MOD;
    cnt++;
  }

  cout << ret << endl;
  
  return 0;
}
0