Submission #32695


ソースコード

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<bits/stdc++.h>
using namespace std;
main(){
int h,w;
cin>>h>>w;
int mp[h][w];
int ph,pw;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>mp[i][j];
if(mp[i][j]==4){
ph=i;
pw=j;
}
}
}
int yaku=0;
int n;
cin>>n;
int com;
for(int i=0;i<n;i++){
cin>>com;
switch(com){
case 1:
while(mp[ph-1][pw]!=1){
--ph;
if(mp[ph][pw]==3){
yaku++;
mp[ph][pw]=0;
}
}
break;
case 2:
while(mp[ph+1][pw]!=1){
++ph;
if(mp[ph][pw]==3){
yaku++;
mp[ph][pw]=0;
}
}
break;
case 3:
while(mp[ph][pw+1]!=1){
++pw;
if(mp[ph][pw]==3){
yaku++;
mp[ph][pw]=0;
}
}
break;
case 4:
while(mp[ph][pw-1]!=1){
--pw;
if(mp[ph][pw]==3){
yaku++;
mp[ph][pw]=0;
}
}
}
}
cout<<yaku<<endl;
return 0;
}

ステータス

項目 データ
問題 0387 - 回れ雛月花 -Easy
ユーザー名 crom
投稿日時 2018-04-16 12:14:59
言語 C++11
状態 Accepted
得点 3
ソースコード長 909 Byte
最大実行時間 33 ms
最大メモリ使用量 604 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
spin_input01 AC 33 ms 604 KB
1
spin_input02 AC 17 ms 444 KB
1
spin_input03 AC 22 ms 544 KB
1
spin_input04 AC 18 ms 516 KB
1
spin_input05 AC 24 ms 488 KB
1