結果

問題 No.1238 選抜クラス
ユーザー NiwakaNiwaka
提出日時 2020-09-26 18:51:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 2,889 bytes
コンパイル時間 1,004 ms
コンパイル使用メモリ 89,632 KB
実行使用メモリ 808,528 KB
最終ジャッジ日時 2023-09-12 00:13:53
合計ジャッジ時間 11,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 4 ms
4,604 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,420 KB
testcase_16 AC 4 ms
4,632 KB
testcase_17 AC 585 ms
402,012 KB
testcase_18 AC 523 ms
369,412 KB
testcase_19 AC 511 ms
361,756 KB
testcase_20 AC 471 ms
330,920 KB
testcase_21 AC 459 ms
323,220 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 MLE -
testcase_25 MLE -
testcase_26 AC 574 ms
401,996 KB
testcase_27 AC 583 ms
409,984 KB
testcase_28 AC 541 ms
379,508 KB
testcase_29 AC 538 ms
379,088 KB
testcase_30 AC 16 ms
13,880 KB
testcase_31 AC 103 ms
76,444 KB
testcase_32 AC 270 ms
191,752 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 374 ms
264,532 KB
testcase_35 AC 32 ms
25,524 KB
testcase_36 AC 6 ms
6,556 KB
testcase_37 AC 21 ms
16,708 KB
testcase_38 AC 496 ms
351,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>
#include<stack>
#include <utility>
#include <tuple>
#define INF 1000000000000
const long long MOD = 1000000007;

using namespace std;
typedef long long llong;
#define debug cout << "Hello" << endl;
//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	(指定した場所に)文字・文字列を挿入する
//erase()	(指定した場所の)文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の(指定した)部分文字列を返す
//replace()	(指定した)部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数:reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド 引数:サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

int main(){
    llong N,K;
    cin >> N >> K;
    vector<llong> A(N+1, 0);
    llong total=0;

    for(int i=1; i<=N; i++){
        cin >> A[i];
        total = total + A[i];
    }

    vector<vector<vector<llong> > > dp(N+1, vector<vector<llong> >(N+1, vector<llong>(total+1, 0)));
    dp[0][0][0] = 1;

    for(int i=1; i<=N; i++){
        for(int j=0; j<=N; j++){
            for(int k=0; k<=total; k++){
                if(j-1<0){
                    dp[i][j][k] = dp[i-1][j][k]%MOD;
                    continue;
                }
                if(k-A[i]<0){
                    dp[i][j][k] = dp[i-1][j][k]%MOD;
                    continue;
                }
                dp[i][j][k] = (dp[i-1][j][k]%MOD+dp[i-1][j-1][k-A[i]]%MOD)%MOD;
            }
        }
    }
    llong ans=0;
    for(int i=1; i<=N; i++){
        for(int j=0; j<=total; j++){
            if(K<=((double)j/(double)i)){
                ans = (ans%MOD + dp[N][i][j]%MOD)%MOD;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0