結果

問題 No.393 2本の竹
ユーザー rapurasurapurasu
提出日時 2016-07-12 13:20:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,484 bytes
コンパイル時間 1,724 ms
コンパイル使用メモリ 178,040 KB
実行使用メモリ 47,800 KB
最終ジャッジ日時 2024-04-23 01:50:00
合計ジャッジ時間 6,082 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
LL n1[11];
LL n2[11];
LL m[11];
LL A[11][70]; 
int main(){
    int d;
    cin>>d;
    REP(i,d){
        cin>>n1[i]>>n2[i];
        cin>>m[i];
        REP(j,m[i]){
            cin>>A[i][j];
        }
    }
    REP(i,d){
        map<vector<int>,int>dp;
        vector<int> s(2,0);
        s[0]=n1[i];
        s[1]=n2[i];
        dp[s]=0;
        REP(j,m[i]){
            map<vector<int>,int>nxt;
            for(map<vector<int>,int>::iterator it=dp.begin();it!=dp.end();it++){
                    vector<int> c=(it)->first;
                    int num=it->second;
                    nxt[c]=max(nxt[c],num);
                    if(c[0]>=A[i][j]){
                       vector<int>a(2,0);
                       a[0]=c[0]-A[i][j];
                       a[1]=c[1];
                       nxt[a]=max(nxt[a],num+1);
                    }
                    if(c[1]>=A[i][j]){
                       vector<int>a(2,0);
                       a[0]=c[0];
                       a[1]=c[1]-A[i][j];
                       nxt[a]=max(nxt[a],num+1);
                    }
            }
            swap(dp,nxt);
        }
        int mm=0;
        for(map<vector<int>,int>::iterator it=dp.begin();it!=dp.end();it++){
            int num=it->second;
            if(mm<num){
               mm=num;
            }
        }
        cout<<mm<<endl;
    }
}
0