結果

問題 No.794 チーム戦 (2)
ユーザー TomoyaTomoya
提出日時 2019-02-23 21:59:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 45 ms / 1,500 ms
コード長 1,781 bytes
コンパイル時間 1,622 ms
コンパイル使用メモリ 96,432 KB
実行使用メモリ 4,872 KB
最終ジャッジ日時 2023-08-21 05:28:54
合計ジャッジ時間 4,234 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 45 ms
4,552 KB
testcase_15 AC 45 ms
4,572 KB
testcase_16 AC 44 ms
4,624 KB
testcase_17 AC 45 ms
4,664 KB
testcase_18 AC 44 ms
4,628 KB
testcase_19 AC 44 ms
4,628 KB
testcase_20 AC 45 ms
4,584 KB
testcase_21 AC 44 ms
4,684 KB
testcase_22 AC 27 ms
4,376 KB
testcase_23 AC 25 ms
4,380 KB
testcase_24 AC 20 ms
4,380 KB
testcase_25 AC 16 ms
4,376 KB
testcase_26 AC 18 ms
4,376 KB
testcase_27 AC 20 ms
4,732 KB
testcase_28 AC 20 ms
4,668 KB
testcase_29 AC 20 ms
4,568 KB
testcase_30 AC 20 ms
4,704 KB
testcase_31 AC 20 ms
4,872 KB
testcase_32 AC 20 ms
4,668 KB
testcase_33 AC 20 ms
4,552 KB
testcase_34 AC 20 ms
4,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

#define int long long int

signed
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  sort(a.rbegin(), a.rend());

  int ans = 1;  
  int j = n-1;
  for(int i=0; i<n/2; i++){
    while(j > i and a[i]+a[j] <= k) j--;
    j = max(i, j);
    if(j == n-1){ans = 0; break;}    
    (ans *= n-1-j-i) %= MOD;
  }  
  cout << ans << endl;
  
  return 0;
}

0