結果

問題 No.794 チーム戦 (2)
ユーザー 37zigen37zigen
提出日時 2019-02-23 11:01:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 94 ms / 1,500 ms
コード長 652 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 147,164 KB
実行使用メモリ 5,344 KB
最終ジャッジ日時 2023-08-19 10:28:28
合計ジャッジ時間 4,797 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 94 ms
5,132 KB
testcase_15 AC 93 ms
5,064 KB
testcase_16 AC 93 ms
5,236 KB
testcase_17 AC 93 ms
5,072 KB
testcase_18 AC 92 ms
5,316 KB
testcase_19 AC 92 ms
5,344 KB
testcase_20 AC 92 ms
5,072 KB
testcase_21 AC 92 ms
5,192 KB
testcase_22 AC 57 ms
4,568 KB
testcase_23 AC 50 ms
4,380 KB
testcase_24 AC 39 ms
4,376 KB
testcase_25 AC 33 ms
4,376 KB
testcase_26 AC 37 ms
4,376 KB
testcase_27 AC 35 ms
5,244 KB
testcase_28 AC 34 ms
5,064 KB
testcase_29 AC 35 ms
5,056 KB
testcase_30 AC 34 ms
5,316 KB
testcase_31 AC 35 ms
5,164 KB
testcase_32 AC 35 ms
5,124 KB
testcase_33 AC 34 ms
5,144 KB
testcase_34 AC 35 ms
5,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

const long long mo=(long long)1e9+7;

long long A[2*100000];
bool vis[2*100000];

long long f(long long a){
  long long ret=1;
  while(a>0){
    ret=ret*(a-1)%mo;
    a-=2;
  }
  return ret;
}

int main(){

  int N;
  int K;

  std::cin>>N>>K;

  for(int i=0;i<N;++i){
    std::cin>>A[i];
    vis[i]=false;
  }
  std::sort(A,A+N);

  int t=0;
  long long ans=1;

  for(int i=N-1;i>=0;--i){
    while(t<N&&A[i]+A[t]<=K){
      vis[t]=true;
      ++t;
    }
    if(vis[i]){
      ans=ans*(std::max(1LL,f(N-2*(N-1-i))))%mo;
      break;
    }
    ans=ans*(std::max(t-(N-1-i),0))%mo;
  }
  std::cout<<ans<<std::endl;
  return 0;
}
0