結果
問題 | No.846 メダル |
ユーザー | Novi |
提出日時 | 2020-07-29 20:21:05 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,048 bytes |
コンパイル時間 | 1,403 ms |
コンパイル使用メモリ | 164,788 KB |
実行使用メモリ | 7,764 KB |
最終ジャッジ日時 | 2023-09-12 15:02:48 |
合計ジャッジ時間 | 7,824 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 168 ms
4,380 KB |
testcase_01 | AC | 310 ms
4,376 KB |
testcase_02 | AC | 1,196 ms
4,380 KB |
testcase_03 | AC | 25 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 163 ms
4,376 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
#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; }