結果

問題 No.627 ランダムウォークの軌跡
ユーザー hanorver
提出日時 2018-03-19 22:18:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 80,528 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 17:46:46
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <stack>


int main (void){
	int n;

	std::cin >> n;

	int pos = 0;

	bool result = true;
	for (size_t i = 0; i < n; i++)
	{
		int next_pos;
		std::cin >> next_pos;

		if (next_pos + 1 == pos || next_pos - 1 == pos) {
			pos = next_pos;
		}
		else {
			result = false;
		}
	}

	std::cout << (result ? "T" : "F") << std::endl;

	return 0;
}
0