結果

問題 No.1132 凸凹
ユーザー kmjp
提出日時 2020-07-26 22:37:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 988 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 193,932 KB
最終ジャッジ日時 2025-01-12 06:26:21
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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: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 ‘void solve()’ at main.cpp:31:19:
/usr/include/c++/13/ostream:204:25: warning: ‘ma_x’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘void solve()’:
main.cpp:23:12: note: ‘ma_x’ was declared here
   23 |         ll ma_x,ma_y=-1LL<<60;
      |            ^~~~
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 ‘void solve()’ at main.cpp:31:41:
/usr/include/c++/13/ostream:204:25: warning: ‘mi_x’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘void solve()’:
main.cpp:24:12: note: ‘mi_x’ was declared here
   24 |         ll mi_x,mi_y=1LL<<60;
      |            ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B,C,D;
ll P,Q;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	cin>>P>>Q;
	ll ma_x,ma_y=-1LL<<60;
	ll mi_x,mi_y=1LL<<60;
	for(ll a=P;a<=Q;a++) {
		ll F=a*a*a*A+a*a*B+a*C+D;
		if(F>ma_y) ma_y=F, ma_x=a;
		if(F<mi_y) mi_y=F, mi_x=a;
	}
	
	cout<<ma_y<<" "<<ma_x<<" "<<mi_y<<" "<<mi_x<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0