結果
問題 |
No.467 隠されていたゲーム
|
ユーザー |
|
提出日時 | 2017-05-02 02:02:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 650 ms |
コンパイル使用メモリ | 73,788 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 16:30:47 |
合計ジャッジ時間 | 1,300 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> int main() { int n; std::vector<int> d; int x, y; int cd; int ans; std::cin >> n; for(int i = 0; i < n; i++) { int tmp; std::cin >> tmp; d.push_back(tmp); } std::cin >> x >> y; int dmax = *std::max_element(d.begin(), d.end()); cd = std::max(std::abs(x), std::abs(y)); if (cd == 0) { ans = 0; } else if (std::find(d.begin(), d.end(), cd) != d.end()) { ans = 1; } else if (cd <= dmax * 2) { ans = 2; } else { ans = cd / (2 * dmax) * 2; cd = cd % (2 * dmax); if (cd > 0) { ans++; } if (cd > dmax) { ans++; } } std::cout << ans << std::endl; }