結果
問題 |
No.846 メダル
|
ユーザー |
![]() |
提出日時 | 2019-07-05 21:43:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 817 ms |
コンパイル使用メモリ | 74,088 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 21:19:21 |
合計ジャッジ時間 | 1,293 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 1 |
ソースコード
#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; }