結果
問題 | No.846 メダル |
ユーザー |
![]() |
提出日時 | 2020-07-29 20:21:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,048 bytes |
コンパイル時間 | 1,317 ms |
コンパイル使用メモリ | 168,732 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-06-30 03:05:44 |
合計ジャッジ時間 | 6,840 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | AC * 7 WA * 4 TLE * 1 -- * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define rep2(i,x,n) for(int i=x; i<(n); i++) #define ALL(n) begin(n),end(n) #define INF ((1<<30)-1) #define LINF (1LL<<60) #define EPS (1e-10) typedef long long Int; typedef pair<Int, Int> P; typedef pair<int, int> pint; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; Int judge(Int n, Int s){ if(n%s==0) return n/s; else return n/s+1; } int main() { cin.tie(0); ios::sync_with_stdio(false); Int p,q,r; cin>>p>>q>>r; Int a,b,c; cin>>a>>b>>c; Int t= __gcd(a,b); Int g= __gcd(t,c); Int j= a*b*c/g; Int ans_min=LINF; Int ans_max=0; Int cnt=0; for(Int i=1; i<=j; i++){ Int x,y,z; x=judge(i,p); y=judge(i,q)-x; z=judge(i,r)-x-y; if((x==a)&&(y==b)&&(z==c)) { ans_min=min(ans_min,i); ans_max=max(ans_max,i); cnt++; } } if(cnt==0) cout<<-1<<endl; else cout<<ans_min<<" "<<ans_max<<endl; return 0; }