Submission #32599


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
($h,$w) = split(/ /,<STDIN>);chomp($h,$w);
$nh,$nw;
for($i=0; $i<$h;$i++){
@{$mp[$i]} = split(/ /,<STDIN>);chomp(@{$mp[$i]});
for($j=0; $j<$w; $j++){
if($mp[$i][$j] == 4){
$nh = $i; $nw = $j;
}
}
}
@vh = (-1,1,0,0);
@vw = (0,0,1,-1);
$ ans = 0;
$n = <STDIN>;chomp($n);
for($i=0; $i<$n; $i++){
$p = <STDIN>;chomp($p);$p--;
while(1){
if($mp[$nh+$vh[$p]][$nw+$vw[$p]] == 1){
last;
}
$nh += $vh[$p]; $nw += $vw[$p];
if($mp[$nh][$nw] == 3){
$mp[$nh][$nw] = 0;
$ans++;
}
}
}
print $ans."\n";

ステータス

項目 データ
問題 0387 - 回れ雛月花 -Easy
ユーザー名 PerlC
投稿日時 2018-04-11 22:30:53
言語 Perl
状態 Accepted
得点 3
ソースコード長 556 Byte
最大実行時間 65 ms
最大メモリ使用量 968 KB

セット

セット 得点 Cases
1 ALL 3 / 3 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
spin_input01 AC 65 ms 736 KB
1
spin_input02 AC 22 ms 780 KB
1
spin_input03 AC 20 ms 812 KB
1
spin_input04 AC 20 ms 720 KB
1
spin_input05 AC 18 ms 968 KB
1