結果
| 問題 | No.602 隠されていたゲーム2 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-12-02 00:15:17 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,021 bytes | 
| コンパイル時間 | 943 ms | 
| コンパイル使用メモリ | 96,944 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-28 00:00:49 | 
| 合計ジャッジ時間 | 1,578 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 4 | 
ソースコード
#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 = -10000000000001;
	long long int em = -10000000000000;
	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);
	if (!a && !b) {
		cout << "0\n";
		return 0;
	}
	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";
	return 0;
}
            
            
            
        