結果

問題 No.846 メダル
ユーザー IchimiyaIchimiya
提出日時 2020-05-13 01:55:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 1,532 ms
コンパイル使用メモリ 164,824 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-12 06:20:05
合計ジャッジ時間 5,658 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,796 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int64_t P, Q, R, A, B, C;
	cin >> P >> Q >> R >> A >> B >> C;

	int64_t N = 0;
	int f = 0;
	int64_t n = P * (A - 1) + 1,
			m = P * (A + 1) - 1;
	//cout << "n:" << n << ' ' << "m:" << m << endl;

	int64_t min = -1, max = -1;
	for (int64_t i = n; i <= m; i++) {
		int64_t x = i % Q;
		if (x) {
			x = i / Q;
			x++;
		}
		else {
			x = i / Q;
		}
		//cout << "x:" << x << endl;

		x -= A;
		if (x == B) {
			int64_t y = i % R;
			if (y) {
				y = i / R;
				y++;
			}
			else {
				y = i / R;
			}

			y -= (A + B);
			if (y == C) {
				if (!f) {
					min = i;
					f = 1;
				}
				else {
					max = i;
				}
				//cout << "push" << endl;
			}
		}
		else {
			continue;
		}
	}

	if (!f) {
		cout << -1 << endl;
		return 0;
	}
	else {
		cout << min << ' ' << max << endl;
	}
}
0