hiho week 66 register

Ended

Participants:488

Verdict:Accepted
Score:100 / 100
Submitted:2015-10-05 20:01:56

Lang:G++

Edit
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
#include<iostream>
#include<string.h>
#include<queue>
using namespace std;
struct Step
{
    int x;
    int step;
    Step(int a,int b):x(a),step(b){}
};
queue<Step> q;
const int MAXNUM=3000;
int n,m,t=0,init,minx=MAXNUM;
char a[10000];
int x[10000],y[10000];//2S
int dfs(int begin,int end);
int main()
{
    cin>>n>>m;
    for(int i=0;i!=n*m;++i){
        cin>>a[i];
        if(a[i]=='H') init=i;
        if(i==0) continue;
        if(a[i]=='S'&&i%m>0&&a[i-1]=='S'){x[t]=i;y[t]=i-1;++t;}
        if(i-m<0) continue;
        if(a[i]=='S'&&a[i-m]=='S'){x[t]=i;y[t]=i-m;++t;}
    }
    if(x[0]==0&&y[0]==0){cout<<"Hi and Ho will not have lunch."<<endl; return 0;}
    for(int k=0;k<t;++k)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX