Submission #03654


ソースコード

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
#include<bits/stdc++.h>
#define F first
#define S second
#define INF (1<<30)
#define LLINF (1LL<<60)
using namespace std;
main(){
long long h,w,p,meirei;
long long cnt=0,num;
long long maps[200][200]={0};
long long sw,sh;
long long dw[4]={0,0,1,-1};
long long dh[4]={-1,1,0,0};
cin>>h>>w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>maps[i][j];
if(maps[i][j]==4){
sw=j;
sh=i;
}
}
}
cin>>p;
for(int i=0;i<p;i++){
cin>>meirei;
meirei--;
while(sw>=0&&sh>=0&&sw<w&&sh<h&&maps[sh+dh[meirei]][sw+dw[meirei]]!=1){
sw+=dw[meirei];
sh+=dh[meirei];
if(maps[sh][sw]==3){
maps[sh][sw]=0;
cnt++;
}
}
}
cout<<cnt<<endl;
}

ステータス

項目 データ
問題 0387 - 回れ雛月花 -Easy
ユーザー名 ei1417
投稿日時 2016-04-28 17:44:13
言語 C++11
状態 Accepted
得点 3
ソースコード長 747 Byte
最大実行時間 26 ms
最大メモリ使用量 796 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
spin_input01 AC 26 ms 732 KB
1
spin_input02 AC 16 ms 776 KB
1
spin_input03 AC 15 ms 700 KB
1
spin_input04 AC 11 ms 748 KB
1
spin_input05 AC 11 ms 796 KB
1