結果

問題 No.627 ランダムウォークの軌跡
ユーザー neko_the_shadow
提出日時 2021-09-08 10:13:51
言語 Perl
(5.40.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 5,760 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2024-12-25 12:03:43
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use feature qw/state/;

sub output {
    my $line = join " ", @_;
    print "$line\n";
}

sub input {
    state @que;
    if (@que == 0) {
        chomp(my $line = <>);
        push @que, split / /, $line;
    }
    return shift @que;
}

my $t = input;
my @x = (0);
for (my $i = 0; $i < $t; $i++) {
    push @x, input;
}
for (my $i = 0; $i < $t; $i++) {
    if (abs($x[$i] - $x[$i+1]) != 1) {
        output "F";
        exit;
    }
}
output "T";
0