結果
問題 | No.1010 折って重ねて |
ユーザー |
|
提出日時 | 2020-03-20 21:32:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 905 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 171,636 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 04:19:06 |
合計ジャッジ時間 | 2,960 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::cerr; using std::endl; using std::cin; template<typename T> std::vector<T> make_v(size_t a){return std::vector<T>(a);} template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){ return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); } int main() { i64 x, y, h; scanf("%lld%lld%lld", &x, &y, &h); x *= 1000; y *= 1000; auto dp = make_v<bool>(32, 32); dp[0][0] = true; for(int i = 0; i < 32; i++) { for(int j = 0; j < 32; j++) { if(!dp[i][j]) continue; i64 H = h << (i + j); i64 X = x >> i, Y = y >> j; if(X >= H) dp[i + 1][j] = true; if(Y >= H) dp[i][j + 1] = true; } } int ans = 0; for(int i = 0; i < 32; i++) for(int j = 0; j < 32; j++) if(dp[i][j]) ans = std::max(ans, i + j); printf("%d\n", ans); return 0; }