hiho week 166 register

Ended

Participants:289

Verdict:Accepted
Score:100 / 100
Submitted:2017-09-07 08:31:11

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<cstdio>
#include<queue>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
void fre() { freopen("C://Users//laeen//Desktop//input.txt", "r", stdin);}
struct lenka
{
    int x,y,sum;
}key[10];
char s[105][105];
int v[105][105][1<<6];
int d[4][2]={-1,0,0,-1,1,0,0,1};
int n,m,ex,ey;
int bfs(int nx,int ny)
{
    
    memset(v,0,sizeof v);
    v[nx][ny][0]=1;
    queue<struct lenka>p;
    p.push((lenka){nx,ny,0});
    while(!p.empty())
    {
        lenka now=p.front();p.pop();
        if(now.x==ex&&now.y==ey)return v[now.x][now.y][now.sum]-1;
        for(int i=0;i<4;i++)
        {
            nx=now.x+d[i][0];
            ny=now.y+d[i][1];
            if(nx>=0&&nx<n&&ny>=0&&ny<m&&s[nx][ny]!='#')
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX