結果

問題 No.794 チーム戦 (2)
ユーザー KotRmKotRm
提出日時 2019-03-15 10:17:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,099 bytes
コンパイル時間 1,191 ms
コンパイル使用メモリ 68,472 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-11 01:40:16
合計ジャッジ時間 6,291 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#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 SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())
#define print(x) cout << x << endl;
using namespace std;
const int MOD = (int)1e9 + 7;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i,N) cin >> A[i];
    sort(A.rbegin(), A.rend());
        
    int m=0;
    for(int i = 0; i < N, 2*A[i]>K; i++)
        m+=1;
    
    int ans = 1;
    REP(i, m){
        REP(j, N-m)
            if(A[i]+A[m+j]<=K){
                ans *= (N-(m+j)-i);
                ans %= MOD;
                break;
            }
    }
    for(int i = N-2*m; i > 0; i-=2){
        ans *= i*(i-1)/2;
        ans %= MOD;
    }
    int b = 1;
    for(int i = (N-2*m)/2; i > 0; i--){
        b *= i;
    }
    ans = ans / b;
    ans %= MOD;
    
    print(ans);
    return 0;
}
0