hiho week 185 register

Ended

Participants:167

Verdict:Accepted
Score:100 / 100
Submitted:2018-01-13 23:14:02

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 <utility>
#include <cstring>
#include <deque>
using namespace std;
int A[501], B[501], dist[501][501];
pair<int, int> node[501];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
int calc_dist(int x, int y, int k)
{
    if (k == 0) return B[y];
    
    if (k == 1) return B[y - 1];
    
    if (k == 2) return A[x - 1];
    
    return A[x];
}
int main()
{
    int N, M, K, Q, x1, y1, x2, y2;
    cin >> N >> M;
    
    for (int i = 1; i < N; ++i) 
    {
        cin >> A[i];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX