結果
問題 |
No.1132 凸凹
|
ユーザー |
|
提出日時 | 2020-08-01 08:08:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 879 bytes |
コンパイル時間 | 3,776 ms |
コンパイル使用メモリ | 108,612 KB |
最終ジャッジ日時 | 2025-01-12 12:16:45 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
コンパイルメッセージ
In file included from /usr/include/c++/13/iostream:41, 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:41:54: /usr/include/c++/13/ostream:204:25: warning: ‘res’ may be used uninitialized [-Wmaybe-uninitialized] 204 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function ‘int main()’: main.cpp:28:8: note: ‘res’ was declared here 28 | ll res,res2; | ^~~ 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:41:26: /usr/include/c++/13/ostream:204:25: warning: ‘res2’ may be used uninitialized [-Wmaybe-uninitialized] 204 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function ‘int main()’: main.cpp:28:12: note: ‘res2’ was declared here 28 | ll res,res2; | ^~~~
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> #include <deque> #include <stack> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll a,b,c,d,p,q; cin >> a >> b >> c >> d >> p >> q; ll res,res2; ll mi=2e18,ma=-2e18; for(ll i=p;i<=q;i++){ ll r=a*i*i*i+b*i*i+c*i+d; if(mi>r){ mi=r; res=i; } if(ma<r){ ma=r; res2=i; } } cout << ma << " " << res2 << " " << mi << " " << res << endl; }