結果

問題 No.1132 凸凹
ユーザー chocoruskchocorusk
提出日時 2020-07-27 08:48:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 122,392 KB
最終ジャッジ日時 2025-01-12 06:46:46
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /usr/include/c++/13/iostream:41,
                 from main.cpp:3:
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:42:17:
/usr/include/c++/13/ostream:204:25: warning: ‘mxx’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:32:31: note: ‘mxx’ was declared here
   32 |         ll mx=-1e18, mn=1e18, mxx, mnx;
      |                               ^~~
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:42:36:
/usr/include/c++/13/ostream:204:25: warning: ‘mnx’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:32:36: note: ‘mnx’ was declared here
   32 |         ll mx=-1e18, mn=1e18, mxx, mnx;
      |                                    ^~~

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll a, b, c, d, p, q; cin>>a>>b>>c>>d>>p>>q;
	ll mx=-1e18, mn=1e18, mxx, mnx;
	for(ll i=p; i<=q; i++){
		ll v=a*i*i*i+b*i*i+c*i+d;
		if(mx<v){
			mx=v, mxx=i;
		}
		if(mn>v){
			mn=v, mnx=i;
		}
	}
	cout<<mx<<" "<<mxx<<" "<<mn<<" "<<mnx<<endl;
	return 0;
}
0