結果

問題 No.602 隠されていたゲーム2
ユーザー olpheolphe
提出日時 2017-12-02 00:04:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 96,052 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 21:26:20
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 5 ms
5,376 KB
testcase_18 AC 10 ms
5,376 KB
testcase_19 AC 12 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 13 ms
5,376 KB
testcase_23 AC 12 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "cmath"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<long long int>v(N);
	long long int om = -1;
	long long int em = 0;
	for (int i = 0; i < N; i++) {
		cin >> v[i];
		if (v[i] % 2) {
			om = max(om, v[i]);
		}
		else {
			em = max(em, v[i]);
		}
	}
	long long int a, b;
	cin >> a >> b;
	a = abs(a);
	b = abs(b);
	for (int i = 0; i < N; i++) {
		if (v[i] == a + b) {
			cout << "1\n";
			return 0;
		}
	}
	if ((a + b) % 2) {
		if (om + em > a + b) {
			cout << "2\n";
			return 0;
		}
	}
	else {
		if (em * 2 > a + b || om * 2 > a + b) {
			cout << "2\n";
			return 0;
		}
	}
	cout << "-1\n";
	return 0;
}
0