結果

問題 No.733 分身並列コーディング
ユーザー chocopuuchocopuu
提出日時 2019-03-02 10:37:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 1,500 ms
コード長 1,167 bytes
コンパイル時間 1,597 ms
コンパイル使用メモリ 165,860 KB
実行使用メモリ 26,104 KB
最終ジャッジ日時 2023-09-05 16:47:52
合計ジャッジ時間 4,357 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 58 ms
25,932 KB
testcase_04 AC 58 ms
25,896 KB
testcase_05 AC 60 ms
26,004 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 61 ms
26,040 KB
testcase_08 AC 60 ms
26,088 KB
testcase_09 AC 27 ms
15,708 KB
testcase_10 AC 4 ms
4,920 KB
testcase_11 AC 4 ms
4,796 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 13 ms
9,492 KB
testcase_15 AC 3 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 4 ms
4,780 KB
testcase_19 AC 27 ms
15,844 KB
testcase_20 AC 27 ms
15,724 KB
testcase_21 AC 13 ms
9,520 KB
testcase_22 AC 58 ms
25,896 KB
testcase_23 AC 14 ms
9,508 KB
testcase_24 AC 14 ms
9,512 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 62 ms
25,888 KB
testcase_29 AC 60 ms
26,016 KB
testcase_30 AC 61 ms
26,012 KB
testcase_31 AC 60 ms
25,956 KB
testcase_32 AC 8 ms
7,452 KB
testcase_33 AC 8 ms
7,468 KB
testcase_34 AC 8 ms
7,528 KB
testcase_35 AC 7 ms
7,536 KB
testcase_36 AC 7 ms
7,460 KB
testcase_37 AC 7 ms
7,480 KB
testcase_38 AC 61 ms
26,104 KB
testcase_39 AC 60 ms
25,904 KB
testcase_40 AC 61 ms
25,896 KB
testcase_41 AC 8 ms
7,728 KB
testcase_42 AC 7 ms
7,612 KB
testcase_43 AC 7 ms
7,460 KB
testcase_44 AC 60 ms
25,960 KB
testcase_45 AC 61 ms
25,900 KB
testcase_46 AC 60 ms
25,888 KB
testcase_47 AC 61 ms
25,892 KB
testcase_48 AC 60 ms
25,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;

int T,N;
int t[100010];
int dp[1ll<<20][20];


signed main() {
    IOS();
    cin>>T>>N;
    rep(i,0,N)cin>>t[i];
    rep(i,1,(1ll<<N))rep(j,0,N)dp[i][j]=INF;
    rep(i,1,(1ll<<N)){
        rep(j,0,N){
            if(i&(1ll<<j)){
                rep(k,0,N+1){
                    chmin(dp[i][k],dp[i^(1ll<<j)][k]+t[j]);
                    if(dp[i][k]<=T){
                        dp[i][k+1]=0;
                    }
                }
            }
        }
    }
    rep(i,1,N+1){
        if(!dp[(1ll<<N)-1][i]){
            cout<<i<<endl;
            return 0;
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}
0