結果
| 問題 | No.1132 凸凹 |
| ユーザー |
|
| 提出日時 | 2020-08-22 02:55:03 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 706 bytes |
| 記録 | |
| コンパイル時間 | 554 ms |
| コンパイル使用メモリ | 112,552 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-12 15:23:43 |
| 合計ジャッジ時間 | 1,960 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:11: warning: 'Mx' may be used uninitialized [-Wmaybe-uninitialized]
28 | printf("%lld %lld %lld %lld\n", M, Mx, m, mx);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:22:35: note: 'Mx' was declared here
22 | ll M = -INF<ll>, m = INF<ll>, Mx, mx;
| ^~
main.cpp:28:11: warning: 'mx' may be used uninitialized [-Wmaybe-uninitialized]
28 | printf("%lld %lld %lld %lld\n", M, Mx, m, mx);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:22:39: note: 'mx' was declared here
22 | ll M = -INF<ll>, m = INF<ll>, Mx, mx;
| ^~
ソースコード
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
int main() {
ll a, b, c, d, p, q;
cin >> a >> b >> c >> d >> p >> q;
ll M = -INF<ll>, m = INF<ll>, Mx, mx;
for (int i = p; i <= q; ++i) {
ll val = a*i*i*i+b*i*i+c*i+d;
if(M < val) M = val, Mx = i;
if(m > val) m = val, mx = i;
}
printf("%lld %lld %lld %lld\n", M, Mx, m, mx);
return 0;
}