結果

問題 No.846 メダル
ユーザー kotatsugame
提出日時 2019-07-07 18:18:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 67,628 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 01:04:12
合計ジャッジ時間 1,527 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
long P,Q,R,A,B,C;
long l,r;
main()
{
	l=-1;
	r=1e18;
	cin>>P>>Q>>R>>A>>B>>C;
	l=max(l,P*(A-1)+1);
	r=min(r,P*A);
	l=max(l,Q*(A+B-1)+1);
	r=min(r,Q*(A+B));
	l=max(l,R*(A+B+C-1)+1);
	r=min(r,R*(A+B+C));
	if(l<=r)cout<<l<<" "<<r<<endl;
	else cout<<-1<<endl;
}
0