結果
| 問題 |
No.2078 魔抜けなパープル
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2022-09-25 21:24:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 644 ms / 2,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 3,806 ms |
| コンパイル使用メモリ | 252,364 KB |
| 最終ジャッジ日時 | 2025-02-07 15:16:37 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#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;
}
ldsyb