結果
| 問題 |
No.602 隠されていたゲーム2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-02 05:55:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 771 bytes |
| コンパイル時間 | 563 ms |
| コンパイル使用メモリ | 72,320 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 22:06:58 |
| 合計ジャッジ時間 | 1,539 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 5 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
int move_mass[n];
int parity_max[2] = {0, 0};
for(int i = 0; i < n; i++){
cin >> move_mass[i];
parity_max[move_mass[i] % 2] = max(parity_max[move_mass[i] % 2], move_mass[i]);
}
int x, y;
cin >> x >> y;
sort(move_mass, move_mass + n);
for(int i = 0; i < n; i++){
if(move_mass[i] == abs(x) + abs(y)){
cout << 1 << endl;
return 0;
}
}
if(((abs(x) + abs(y)) % 2 == 0 && max(parity_max[0], parity_max[1]) * 2 >= abs(x) + abs(y)) || parity_max[0] + parity_max[1] >= (abs(x) + abs(y))){
cout << 2 << endl;
return 0;
}
cout << -1 << endl;
}