結果

問題 No.627 ランダムウォークの軌跡
ユーザー GrenacheGrenache
提出日時 2018-01-06 12:31:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 1,072 bytes
コンパイル時間 3,361 ms
コンパイル使用メモリ 74,240 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-08-24 22:15:43
合計ジャッジ時間 8,970 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,636 KB
testcase_01 AC 125 ms
55,668 KB
testcase_02 AC 126 ms
55,604 KB
testcase_03 AC 127 ms
56,160 KB
testcase_04 AC 123 ms
55,552 KB
testcase_05 AC 125 ms
55,904 KB
testcase_06 AC 125 ms
56,064 KB
testcase_07 AC 126 ms
55,628 KB
testcase_08 AC 126 ms
55,612 KB
testcase_09 AC 126 ms
56,112 KB
testcase_10 AC 126 ms
56,140 KB
testcase_11 AC 126 ms
55,996 KB
testcase_12 AC 127 ms
55,864 KB
testcase_13 AC 126 ms
55,860 KB
testcase_14 AC 125 ms
55,600 KB
testcase_15 AC 127 ms
55,744 KB
testcase_16 AC 127 ms
55,936 KB
testcase_17 AC 128 ms
55,412 KB
testcase_18 AC 128 ms
55,388 KB
testcase_19 AC 133 ms
55,764 KB
testcase_20 AC 130 ms
55,672 KB
testcase_21 AC 129 ms
55,792 KB
testcase_22 AC 130 ms
56,164 KB
testcase_23 AC 132 ms
56,044 KB
testcase_24 AC 131 ms
55,676 KB
testcase_25 AC 131 ms
55,428 KB
testcase_26 AC 131 ms
56,120 KB
testcase_27 AC 133 ms
55,944 KB
testcase_28 AC 133 ms
55,928 KB
testcase_29 AC 133 ms
55,624 KB
testcase_30 AC 122 ms
55,888 KB
testcase_31 AC 124 ms
56,104 KB
testcase_32 AC 124 ms
55,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder627 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int t = sc.nextInt();

		int[] x = new int[t];
		for (int i = 0; i < t; i++) {
			x[i] = sc.nextInt();
		}

		boolean flag = true;
		for (int i = 0; i < t; i++) {
			if (i > 0) {
				if (Math.abs(x[i] - x[i - 1]) != 1) {
					flag = false;
					break;
				}
			}

			int tmp = i + 1 - Math.abs(x[i]);
			if (tmp < 0) {
				flag = false;
//				pr.printf("%d %d %d\n", i, x[i], tmp);
				break;
			} else {
				if (tmp % 2 != 0) {
					flag = false;
//					pr.printf("  %d %d %d\n", i, x[i], tmp);
					break;
				}
			}
		}

		if (flag) {
			pr.println("T");
		} else {
			pr.println("F");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0