結果
問題 |
No.627 ランダムウォークの軌跡
|
ユーザー |
![]() |
提出日時 | 2018-02-10 19:47:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 750 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 65,000 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 16:07:49 |
合計ジャッジ時間 | 1,972 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 WA * 2 |
ソースコード
#include<iostream> #include<vector> bool judge(int& a_n, int& a_n1, int& distance) { int plus_an = a_n1 + distance; int minus_an = a_n1 - distance; if (a_n == plus_an || a_n == minus_an) { return true; } return false; } int main() { std::int32_t T; std::vector<int32_t> x; std::vector<bool> ans; std::cin >> T; for (int i = 0; i < T; i++) { int x_tmp; std::cin >> x_tmp; x.push_back(x_tmp); } int distance = 1; for (int i = 1; i < T - 1; i++) { bool ans_tmp = judge(x[i], x[i - 1], distance); ans.push_back(ans_tmp); } int result = true; for (auto i : ans) { if (i == false) result = false; } if (result == true) { std::cout << "T" << std::endl; } else { std::cout << "F" << std::endl; } return 0; }