結果
問題 | No.602 隠されていたゲーム2 |
ユーザー |
|
提出日時 | 2017-12-02 05:28:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 882 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 72,576 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 22:04:16 |
合計ジャッジ時間 | 1,703 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 8 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(){ int n; cin >> n; int move_mass[n]; for(int i = 0; i < n; i++){ cin >> 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; } } for(int i = 0; i < n; i++){ if(upper_bound(move_mass, move_mass + n, abs(x) + abs(y) + move_mass[i]) - lower_bound(move_mass, move_mass + n, abs(x) + abs(y) + move_mass[i]) || upper_bound(move_mass, move_mass + n, abs(x) + abs(y) - move_mass[i]) - lower_bound(move_mass, move_mass + n, abs(x) + abs(y) - move_mass[i])){ cout << 2 << endl; return 0; } } cout << -1 << endl; }