hiho week 99 register

Ended

Participants:253

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-27 15:07:54

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 <cstring>
#include <queue>
using namespace std;
struct myNode{
    int x;
    int y;
    myNode(int valx, int valy): x(valx), y(valy) {}
};
void bfs(int f[][8], int x, int y)
{
    for(int i = 0; i < 8; i++)
        for(int j = 0; j < 8; j++)
            f[i][j] = -1;
    int nowx, nowy;
    f[x][y] = 0;
    queue<myNode*> q;
    myNode* m = new myNode(x, y);
    q.push(m);
    while(!q.empty()){
        m = q.front();
        q.pop();
        x = m->x;
        y = m->y;
        int xi[8] = {-2, -2, -1, -1, 1,  1, 2,  2};
        int yi[8] = {1,  -1,  2, -2, 2, -2, 1, -1};
        for(int i = 0; i < 8; i++) {
            nowx = x + xi[i];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX