結果
問題 |
No.602 隠されていたゲーム2
|
ユーザー |
|
提出日時 | 2017-12-02 00:09:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,007 bytes |
コンパイル時間 | 1,065 ms |
コンパイル使用メモリ | 97,116 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 22:55:22 |
合計ジャッジ時間 | 2,102 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 5 |
ソースコード
#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 = -100000000001; long long int em = -100000000000; 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"; } 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; }