結果
問題 | No.2078 魔抜けなパープル |
ユーザー | ldsyb |
提出日時 | 2022-09-25 21:24:11 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 684 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 4,221 ms |
コンパイル使用メモリ | 261,112 KB |
実行使用メモリ | 4,640 KB |
最終ジャッジ日時 | 2023-08-24 02:00:44 |
合計ジャッジ時間 | 7,659 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
4,376 KB |
testcase_01 | AC | 442 ms
4,380 KB |
testcase_02 | AC | 311 ms
4,376 KB |
testcase_03 | AC | 382 ms
4,376 KB |
testcase_04 | AC | 289 ms
4,376 KB |
testcase_05 | AC | 292 ms
4,380 KB |
testcase_06 | AC | 684 ms
4,376 KB |
testcase_07 | AC | 309 ms
4,640 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using namespace chrono; #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif int main() { int64_t t; cin >> t; int64_t inf = (1LL << 60); for (int64_t _ = 0; _ < t; _++) { int64_t x, a; cin >> x >> a; vector dp(a + 1, inf); dp[a] = 0; for (int64_t i = a; 0 <= i; i--) { for (int64_t j = 1; j <= min<int64_t>(i, 320); j++) { dp[i - j] = min(dp[i - j], dp[i] + j * j + x); } } cout << dp[0] << endl; } return 0; }