結果
問題 |
No.1010 折って重ねて
|
ユーザー |
![]() |
提出日時 | 2020-11-06 17:10:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 642 ms |
コンパイル使用メモリ | 77,504 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 11:49:37 |
合計ジャッジ時間 | 1,820 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <iostream> #include <utility> #include <map> using namespace std; int dfs(map<pair<int, int>, int> &dp, long long x, int xc, long long y, int yc, long long h, int cnt){ if (dp.count(make_pair(xc, yc))){ return dp[make_pair(xc, yc)]; } int ans = cnt; if (x > (h << xc)){ ans = max(ans, dfs(dp, x, xc + 1, y, yc, h * 2, cnt + 1)); } if (y > (h << yc)){ ans = max(ans, dfs(dp, x, xc, y, yc + 1, h * 2, cnt + 1)); } dp[make_pair(xc, yc)] = ans; return ans; } int main(){ long long x, y, h; cin >> x >> y >> h; x *= 1000; y *= 1000; map<pair<int, int>, int> dp; cout << dfs(dp, x, 0, y, 0, h, 0) << endl; }