結果
| 問題 |
No.846 メダル
|
| コンテスト | |
| ユーザー |
onakaT_Titai
|
| 提出日時 | 2019-07-23 18:45:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,674 bytes |
| コンパイル時間 | 850 ms |
| コンパイル使用メモリ | 110,108 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 02:06:56 |
| 合計ジャッジ時間 | 1,605 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using Int = long long;
//using namespace boost::multiprecision;
const double EPS = 1e-10;
long long const MOD = 1000000007;
long long mod_pow(long long x, long long n) {
long long res = 1;
for (int i = 0;i < 60; i++) {
if (n >> i & 1) res = res * x % MOD;
x = x * x % MOD;
}
return res;
}
template<typename T>
T gcd(T a, T b) {
return b != 0 ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
return a * b / gcd(a, b);
}
void fastInput() {
cin.tie(0);
ios::sync_with_stdio(false);
}
int main(void) {
Int P, Q, R; cin >> P >> Q >> R;
Int A, B, C; cin >> A >> B >> C;
// N/P = A, N/P = A
// N/Q - A = B, N/Q = A + B
// N/R - A - B = C, N/R = A + B + C
Int left = -1;
Int right = 5000000000000000000; // 1e18 * 5
left = max(left, A*P-P+1);
left = max(left, Q*A+Q*B-Q+1);
left = max(left, R*A+R*B+R*C-R+1);
right = min(right, A*P);
right = min(right, Q*A+Q*B);
right = min(right, R*A+R*B+R*C);
if (left <= right) {
cout << left << " " << right;
} else {
cout << -1 << endl;
}
}
onakaT_Titai