結果

問題 No.158 奇妙なお使い
ユーザー h_nosonh_noson
提出日時 2016-03-26 15:41:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,238 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 60,196 KB
実行使用メモリ 7,680 KB
最終ジャッジ日時 2024-04-09 23:56:08
合計ジャッジ時間 1,623 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;

int dp[11][101][10001];
bool used[11][101][100001];
int a[3], b[3], c[3];
int db, dc;

int count(int x, int y, int z) {
    if (used[x][y][z])
        return dp[x][y][z];
    used[x][y][z] = true;
    if (db%100<=z && db/100%10<=y+z/100 && db/1000 <= x+y/10+z/1000) {
        int nx = min(x,db/1000);
        int ny = min(y,(db-nx*1000)/100);
        int nz = min(z,db-nx*1000-ny*100);
        dp[x][y][z] = max(dp[x][y][z],count(x-nx+b[0],y-ny+b[1],z-nz+b[2])+1);
    }
    if (dc%100<=z && dc/100%10<=y+z/100 && dc/1000 <= x+y/10+z/1000) {
        int nx = min(x,dc/1000);
        int ny = min(y,(dc-nx*1000)/100);
        int nz = min(z,dc-nx*1000-ny*100);
        dp[x][y][z] = max(dp[x][y][z],count(x-nx+c[0],y-ny+c[1],z-nz+c[2])+1);
    }
    return dp[x][y][z];
}

int main() {
    int i;
    rep (i,3) cin >> a[i];
    cin >> db;
    rep (i,3) cin >> b[i];
    cin >> dc;
    rep (i,3) cin >> c[i];
    cout << count(a[0],a[1],a[2]) << endl;
    return 0;
}
0