結果
問題 | No.846 メダル |
ユーザー |
![]() |
提出日時 | 2019-07-05 21:40:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 2,101 ms |
コンパイル使用メモリ | 194,284 KB |
最終ジャッジ日時 | 2025-01-07 05:55:00 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define int long long using namespace std; typedef pair<int, int> P; const int mod = 1000000007; const int INF = 1e18; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int p[3], a[3]; int l = -1, r = INF; rep(i, 0, 3) cin >> p[i]; rep(i, 0, 3) cin >> a[i]; rep(i, 1, 3) a[i] += a[i - 1]; rep(i, 0, 3){ int tl = (a[i] - 1) * p[i] + 1; int tr = a[i] * p[i]; l = max(l, tl); r = min(r, tr); } if(l > r) cout << -1 << endl; else cout << l << ' ' << r << endl; }