結果
問題 |
No.467 隠されていたゲーム
|
ユーザー |
|
提出日時 | 2017-01-14 16:17:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 762 ms |
コンパイル使用メモリ | 76,416 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-21 12:43:01 |
合計ジャッジ時間 | 1,284 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 2 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <algorithm> template <class T> std::ostream& operator<< (std::ostream& stream, const std::vector<T>& vec) { stream << "[ "; for (const auto &i: vec) stream << i << " "; stream << "]"; return stream; } int solve() { using namespace std; // input int n_input; cin >> n_input; vector<int> d(n_input); for (int i = 0; i < n_input; ++i) { cin >> d[i]; } int goal_x, goal_y; cin >> goal_x >> goal_y; int goal = max(abs(goal_x), abs(goal_y)); // algorithm int max_d = *max_element(d.begin(), d.end()); if (goal == 0) return 0; else { if (max_d == 0) return -1; if (goal < max_d) return 2; else return (goal / max_d) + (goal % max_d == 0 ? 0 : 1); } } int main(void) { std::cout << solve() << std::endl; return 0; }