結果
問題 | No.158 奇妙なお使い |
ユーザー | sugim48 |
提出日時 | 2015-02-26 23:45:12 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 1,601 bytes |
コンパイル時間 | 592 ms |
コンパイル使用メモリ | 85,012 KB |
実行使用メモリ | 13,392 KB |
最終ジャッジ日時 | 2023-09-11 07:51:57 |
合計ジャッジ時間 | 3,069 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
12,956 KB |
testcase_01 | AC | 40 ms
12,712 KB |
testcase_02 | AC | 40 ms
12,992 KB |
testcase_03 | AC | 41 ms
13,160 KB |
testcase_04 | AC | 39 ms
13,208 KB |
testcase_05 | AC | 37 ms
13,168 KB |
testcase_06 | AC | 39 ms
13,176 KB |
testcase_07 | AC | 38 ms
13,224 KB |
testcase_08 | AC | 34 ms
11,920 KB |
testcase_09 | AC | 39 ms
13,156 KB |
testcase_10 | AC | 40 ms
12,952 KB |
testcase_11 | AC | 40 ms
13,188 KB |
testcase_12 | AC | 44 ms
12,952 KB |
testcase_13 | AC | 43 ms
13,392 KB |
testcase_14 | AC | 41 ms
13,148 KB |
testcase_15 | AC | 42 ms
12,992 KB |
testcase_16 | AC | 40 ms
13,152 KB |
testcase_17 | AC | 40 ms
13,284 KB |
testcase_18 | AC | 37 ms
13,376 KB |
testcase_19 | AC | 40 ms
13,180 KB |
testcase_20 | AC | 40 ms
13,180 KB |
testcase_21 | AC | 35 ms
13,144 KB |
testcase_22 | AC | 35 ms
13,300 KB |
testcase_23 | AC | 40 ms
13,252 KB |
testcase_24 | AC | 42 ms
13,184 KB |
testcase_25 | AC | 29 ms
10,048 KB |
testcase_26 | AC | 37 ms
12,420 KB |
testcase_27 | AC | 36 ms
12,164 KB |
testcase_28 | AC | 39 ms
12,832 KB |
testcase_29 | AC | 30 ms
9,824 KB |
testcase_30 | AC | 40 ms
12,808 KB |
ソースコード
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstring> #include <cmath> #include <fstream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { ll B, T, F, P; }; unsigned MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int UNKO = INT_MAX; int dp[11][101][10001]; int main() { int a4, a3, a1; cin >> a4 >> a3 >> a1; int Db; cin >> Db; int b4, b3, b1; cin >> b4 >> b3 >> b1; int Dc; cin >> Dc; int c4, c3, c1; cin >> c4 >> c3 >> c1; for (int y = 0; y <= 10000; y++) for (int i = 0; i <= 10; i++) for (int j = 0; j <= 100; j++) { int k = y - i * 1000 - j * 100; if (k < 0) continue; int& x = dp[i][j][k]; int _Db = Db; int B4 = min(i, _Db / 1000); _Db -= B4 * 1000; int B3 = min(j, _Db / 100); _Db -= B3 * 100; int B1 = min(k, _Db / 1); _Db -= B1 * 1; if (!_Db) x = max(x, dp[i - B4 + b4][j - B3 + b3][k - B1 + b1] + 1); int _Dc = Dc; int C4 = min(i, _Dc / 1000); _Dc -= C4 * 1000; int C3 = min(j, _Dc / 100); _Dc -= C3 * 100; int C1 = min(k, _Dc / 1); _Dc -= C1 * 1; if (!_Dc) x = max(x, dp[i - C4 + c4][j - C3 + c3][k - C1 + c1] + 1); } cout << dp[a4][a3][a1] << endl; }