結果
問題 | No.846 メダル |
ユーザー |
![]() |
提出日時 | 2019-07-05 21:44:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 713 bytes |
コンパイル時間 | 529 ms |
コンパイル使用メモリ | 73,944 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-06 21:21:20 |
合計ジャッジ時間 | 1,256 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int main() { constexpr int n = 3; ll p[n]; for (int i = 0; i < n; i++) { cin >> p[i]; } ll a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { a[i] += a[i - 1]; } ll i0 = 0, i1 = 1LL << 60; for (int i = 0; i < n; i++) { ll t = a[i] * p[i]; i0 = max(i0, t - p[i] + 1); i1 = min(i1, t); } if (i0 > i1) { cout << -1 << endl; } else { cout << i0 << ' ' << i1 << endl; } return 0; }