結果
問題 |
No.602 隠されていたゲーム2
|
ユーザー |
|
提出日時 | 2017-12-02 00:04:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 766 ms |
コンパイル使用メモリ | 96,304 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 22:49:10 |
合計ジャッジ時間 | 1,759 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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 = -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; }