結果

問題 No.406 鴨等間隔の法則
ユーザー motimoti
提出日時 2018-05-20 07:21:46
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 347 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 15,652 KB
最終ジャッジ日時 2023-09-10 23:53:36
合計ジャッジ時間 2,183 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
8,248 KB
testcase_01 WA -
testcase_02 AC 5 ms
4,940 KB
testcase_03 AC 5 ms
4,964 KB
testcase_04 AC 23 ms
12,840 KB
testcase_05 AC 12 ms
7,732 KB
testcase_06 AC 12 ms
7,988 KB
testcase_07 AC 11 ms
7,984 KB
testcase_08 AC 22 ms
12,536 KB
testcase_09 AC 24 ms
13,480 KB
testcase_10 AC 13 ms
8,236 KB
testcase_11 AC 20 ms
11,484 KB
testcase_12 AC 15 ms
9,156 KB
testcase_13 AC 14 ms
8,696 KB
testcase_14 WA -
testcase_15 AC 7 ms
5,632 KB
testcase_16 AC 6 ms
5,572 KB
testcase_17 AC 5 ms
5,156 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 8 ms
6,064 KB
testcase_22 WA -
testcase_23 AC 16 ms
9,464 KB
testcase_24 WA -
testcase_25 AC 25 ms
13,436 KB
testcase_26 WA -
testcase_27 AC 56 ms
15,652 KB
testcase_28 AC 25 ms
13,456 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 24 ms
13,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

$_ = <>;
my @v = split / /,<>;
my %h;
my $count = abs($v[0] - $v[1]);
my $prev = -1;
for my $x (@v) {
  $h{$x} = 1;
  if ($prev != -1 && abs($prev - $x) != $count) {
    print "NO\n";
    exit;
  }
  $prev = $x;
}
my $size = int(keys %h);
if ($size != @v) {
  print "NO\n";
  exit;
}
print "YES\n";
0