結果
問題 |
No.602 隠されていたゲーム2
|
ユーザー |
|
提出日時 | 2017-12-02 05:57:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 822 bytes |
コンパイル時間 | 734 ms |
コンパイル使用メモリ | 73,264 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 22:07:06 |
合計ジャッジ時間 | 1,781 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; if(!x && !y){ cout << 0 << endl; } 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; }