結果

問題 No.627 ランダムウォークの軌跡
ユーザー fal_rndfal_rnd
提出日時 2018-01-05 22:59:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,753 bytes
コンパイル時間 2,849 ms
コンパイル使用メモリ 83,592 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-08-24 21:14:15
合計ジャッジ時間 9,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,736 KB
testcase_01 AC 131 ms
55,740 KB
testcase_02 AC 127 ms
55,696 KB
testcase_03 AC 129 ms
55,860 KB
testcase_04 AC 128 ms
55,704 KB
testcase_05 AC 130 ms
55,464 KB
testcase_06 AC 131 ms
55,764 KB
testcase_07 AC 131 ms
55,456 KB
testcase_08 AC 131 ms
55,448 KB
testcase_09 AC 131 ms
55,884 KB
testcase_10 AC 133 ms
56,040 KB
testcase_11 AC 130 ms
55,752 KB
testcase_12 AC 133 ms
55,840 KB
testcase_13 AC 131 ms
55,812 KB
testcase_14 AC 132 ms
55,828 KB
testcase_15 AC 133 ms
55,668 KB
testcase_16 AC 136 ms
55,452 KB
testcase_17 AC 136 ms
55,856 KB
testcase_18 AC 136 ms
55,856 KB
testcase_19 AC 136 ms
56,200 KB
testcase_20 AC 136 ms
55,940 KB
testcase_21 AC 136 ms
55,844 KB
testcase_22 AC 136 ms
55,936 KB
testcase_23 AC 137 ms
55,660 KB
testcase_24 AC 136 ms
54,004 KB
testcase_25 AC 137 ms
56,296 KB
testcase_26 AC 135 ms
54,288 KB
testcase_27 AC 136 ms
55,736 KB
testcase_28 AC 135 ms
55,744 KB
testcase_29 AC 134 ms
55,460 KB
testcase_30 AC 126 ms
55,900 KB
testcase_31 AC 126 ms
55,796 KB
testcase_32 AC 125 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main_Util{
	private void solve(){
		int n=gInt();
		int[]in=ints(n).toArray();
		if(Math.abs(in[0])!=1){
			System.out.println('F');
			return;
		}
		for(int i:rep(n-1)) {
			if(Math.abs(in[i]-in[i+1])!=1) {
				System.out.println('F');
				return;
			}
		}
		System.out.println('T');
	}

	public static void main(String[]$){
		new Main_Util().solve();
		System.out.flush();
	}

	static class System{
		private static final InputStream in=java.lang.System.in;
		private static final PrintWriter out=new PrintWriter(java.lang.System.out,false);
	}
	static Scanner s=new Scanner(System.in);

	static int gInt(){
		return s.nextInt();
	}
	static long gLong(){
		return s.nextLong();
	}
	static long gDouble(){
		return s.nextLong();
	}

	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t){
		return new Range(f,t);
	}
	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
		int from,to,c;
		Range(int from,int to){
			this.from=from;
			this.to=to;
			this.c=from;
		}
		Range(int n){
			this(0,n-1);
		}
		@Override
		public Iterator<Integer> iterator(){
			return this;
		}
		@Override
		public boolean hasNext(){
			return c<=to;
		}
		@Override
		public int nextInt(){
			return c++;
		}
	}

	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}
	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	static IntStream ints(int n){
		return REPS(n).map(i->gInt());
	}
	static Stream<String> strs(int n){
		return REPS(n).mapToObj(i->s.next());
	}
}
0