結果
| 問題 |
No.1132 凸凹
|
| ユーザー |
👑 |
| 提出日時 | 2021-12-21 10:28:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 622 ms |
| コンパイル使用メモリ | 64,384 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 15:33:32 |
| 合計ジャッジ時間 | 1,506 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39,
from main.cpp:1:
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:22:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'mx' may be used uninitialized [-Wmaybe-uninitialized]
202 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:5:26: note: 'mx' was declared here
5 | long long mn,mnp=-1000,mx,mxp=-1000;
| ^~
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:22:38:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'mn' may be used uninitialized [-Wmaybe-uninitialized]
202 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:5:13: note: 'mn' was declared here
5 | long long mn,mnp=-1000,mx,mxp=-1000;
| ^~
ソースコード
#include <iostream>
using namespace std;
int main(){
long long a,b,c,d,p,q;cin>>a>>b>>c>>d>>p>>q;
long long mn,mnp=-1000,mx,mxp=-1000;
for(long long i = p; q >= i; i++){
if(mnp == -1000){
mnp = i;
mn = a*i*i*i+b*i*i+c*i+d;
}else if(mn > a*i*i*i+b*i*i+c*i+d){
mnp = i;
mn = a*i*i*i+b*i*i+c*i+d;
}
if(mxp == -1000){
mxp = i;
mx = a*i*i*i+b*i*i+c*i+d;
}else if(mx < a*i*i*i+b*i*i+c*i+d){
mxp = i;
mx = a*i*i*i+b*i*i+c*i+d;
}
}
cout << mx << " " << mxp << " " << mn << " " << mnp << endl;
}