結果
| 問題 | No.1132 凸凹 |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-08-27 00:47:46 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 716 bytes |
| 記録 | |
| コンパイル時間 | 606 ms |
| コンパイル使用メモリ | 116,492 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-02 07:34:16 |
| 合計ジャッジ時間 | 1,923 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:9: warning: 'max1' may be used uninitialized [-Wmaybe-uninitialized]
25 | if (max1 < fx){
| ^~
main.cpp:16:19: note: 'max1' was declared here
16 | long long fx, max1, min1, minx, maxx;
| ^~~~
main.cpp:29:9: warning: 'min1' may be used uninitialized [-Wmaybe-uninitialized]
29 | if (min1 > fx) {
| ^~
main.cpp:16:25: note: 'min1' was declared here
16 | long long fx, max1, min1, minx, maxx;
| ^~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
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:34:58:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'minx' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:16:31: note: 'minx' was declared here
16 | long long fx, max1, min1, minx, maxx;
| ^~~~
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:34:28:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'maxx' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:16:37: note: 'maxx' was declared here
16 |
ソースコード
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;
int main()
{
int a, b, c, d, p, q;
cin >> a >> b >> c >> d >> p >> q;
long long fx, max1, min1, minx, maxx;
for (int i = p; i <= q; i++){
fx = a*i*i*i + b*i*i + c*i + d;
if (i == p){
min1 = fx;
minx = p;
max1 = fx;
maxx = p;
}
if (max1 < fx){
max1 = fx;
maxx = i;
}
if (min1 > fx) {
min1 = fx;
minx = i;
}
}
cout << max1 << " " << maxx << " " << min1 << " " << minx << endl;
}
kpinkcat