結果

問題 No.1132 凸凹
ユーザー umezo
提出日時 2020-07-28 05:37:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 191,944 KB
最終ジャッジ日時 2025-01-12 07:05:38
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /usr/include/c++/13/istream:41,
                 from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
                 from main.cpp:5:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
    inlined from ‘int main()’ at main.cpp:25:18:
/usr/include/c++/13/ostream:204:25: warning: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:13:6: note: ‘x’ was declared here
   13 |   ll x,y;
      |      ^
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
    inlined from ‘int main()’ at main.cpp:25:35:
/usr/include/c++/13/ostream:204:25: warning: ‘y’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:13:8: note: ‘y’ was declared here
   13 |   ll x,y;
      |        ^

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ll a,b,c,d,p,q;
  cin>>a>>b>>c>>d>>p>>q;
  
  ll ma=-1e18,mi=1e18;
  ll x,y;
  for(int i=p;i<=q;i++){
    if(mi>a*i*i*i+b*i*i+c*i+d){
      mi=a*i*i*i+b*i*i+c*i+d;
      y=i;
    }
    if(ma<a*i*i*i+b*i*i+c*i+d){
      ma=a*i*i*i+b*i*i+c*i+d;
      x=i;
    }
  }
  
  cout<<ma<<" "<<x<<" "<<mi<<" "<<y<<endl;
  
  return 0;
}
0