[Offer收割]编程练习赛7 register

Ended

Participants:506

Verdict:Time Limit Exceeded
Score:0 / 100
Submitted:2016-08-28 13:02:21

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 <bits/stdc++.h>
using namespace std;
#define x first
#define y second
const int MOD = 1000000007;
const int maxn = 1000 + 10;
typedef pair<int, int> pii;
typedef pair<int, pii> ppi;
int n, m, k, a[maxn], b[maxn];
int vis[maxn][maxn] ,l[maxn][maxn] , sx, sy, ex, ey, des;
int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};
int code(int x, int y)
{
    return (x - 1) * n + y - 1;
}
bool legal(int x, int y)
{
    return x > 0 && x <= n && y > 0 && y <= m;
}
int run()
{
    priority_queue<ppi, vector<ppi>, greater<ppi> > q;
    q.push({0, {sx, sy}});
    l[sx][sy] = 0;
    vis[sx][sy] = 1;
    while (!q.empty())
    {
        ppi from = q.top();
//printf("%d , %d ---> %d \n", from.y.x, from.y.y, from.x);
        q.pop();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX