結果

問題 No.794 チーム戦 (2)
ユーザー どららどらら
提出日時 2019-02-22 23:15:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 1,728 ms
コンパイル使用メモリ 171,584 KB
実行使用メモリ 5,412 KB
最終ジャッジ日時 2023-08-17 04:31:48
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,388 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 99 ms
5,028 KB
testcase_15 AC 99 ms
5,092 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 96 ms
5,380 KB
testcase_19 AC 96 ms
5,116 KB
testcase_20 AC 96 ms
5,108 KB
testcase_21 AC 97 ms
5,032 KB
testcase_22 AC 60 ms
4,376 KB
testcase_23 AC 54 ms
4,376 KB
testcase_24 AC 42 ms
4,380 KB
testcase_25 AC 35 ms
4,380 KB
testcase_26 AC 40 ms
4,380 KB
testcase_27 AC 39 ms
5,072 KB
testcase_28 AC 38 ms
5,072 KB
testcase_29 WA -
testcase_30 AC 36 ms
5,160 KB
testcase_31 AC 39 ms
5,028 KB
testcase_32 AC 39 ms
5,184 KB
testcase_33 AC 39 ms
5,108 KB
testcase_34 AC 39 ms
5,028 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>=0; i--){
    auto iter = upper_bound(ALLOF(v), K-v[i]);
    int j = iter - v.begin();
    if(j >= i) j = max(0,i);
    if(j - cnt <= 0) break;
    ret *= j - cnt;
    ret %= MOD;
    cnt++;
  }

  if(cnt == 0) cout << 0 << endl;
  else cout << ret << endl;
  
  return 0;
}
0