結果

問題 No.1132 凸凹
ユーザー leafirby
提出日時 2020-07-26 15:54:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 1,960 ms
コンパイル使用メモリ 193,260 KB
最終ジャッジ日時 2025-01-12 06:02:32
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  int a, b, c, d, p, q;
  int maxx = -2000000000, maxy = -2000000000, minx = -2000000000, miny = 2000000000;
  cin >> a >> b >> c >> d >> p >> q;
  assert (-1000 <= a && a <= 1000 && -1000 <= b && b <= 1000 && -1000 <= c && c <= 1000 && -1000 <= d && d <= 1000);
  assert (-100 <= p && p <= q && q <= 100);
  for (int x = q; p <= x; x--) {
    int y = a * x * x * x + b * x * x + c * x + d; 
    chmax(maxy, y);
    chmin(miny, y);
    if (maxy == y) maxx = x;
    if (miny == y) minx = x;
  }
  cout << maxy << " " << maxx << " " << miny << " " << minx << endl;
}
0