結果
| 問題 |
No.1132 凸凹
|
| ユーザー |
CELICA
|
| 提出日時 | 2020-08-11 09:18:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 707 bytes |
| コンパイル時間 | 1,880 ms |
| コンパイル使用メモリ | 166,240 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 11:12:19 |
| 合計ジャッジ時間 | 3,014 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a,b,c,d,p,q;
cin >> a >> b >> c >> d >> p >> q;
ll xl{ LLONG_MIN }, xs{ LLONG_MAX }, yl{ LLONG_MIN }, ys{ LLONG_MAX };
for (int i = p; i <= q; ++i)
{
auto f = [&](int x) -> ll
{
return a * x * x * x + b * x * x + c * x + d;
};
ll ans = f(i);
if (ans > yl)
{
xl = i;
yl = ans;
}
if (ans < ys)
{
xs = i;
ys = ans;
}
}
cout << yl << " " << xl << " " << ys << " " << xs << "\n";
return 0;
}
CELICA