求助

P3350 [ZJOI2016] 旅行者

jeffqi @ 2018-08-15 16:00:25

求助大佬 这一段

il void dij(int s,int x1,int x2,int y1,int y2,int h) {
    rep(i,x1,x2)
        rep(j,y1,y2)
            d[getp(i,j)] = h ? d[getp(i,j)] + d[s] : INF;
    d[s] = 0; q.push(s);
    while (!q.empty()) {
        int u = q.top(); q.pop();
        for(int i = f[u]; i; i = e[i].next) {
            int v = e[i].v;
            int x = (v-1) / m + 1,y = (v-1) % m + 1;
            if (x < x1 || x > x2 || y < y1 || y > y2 || d[u] + e[i].w >= d[v]) continue;
            d[v] = d[u] + e[i].w; q.push(v);
        }
    }
}

改成

il void dij(int s,int x1,int x2,int y1,int y2,int h) {
    rep(i,x1,x2)
        rep(j,y1,y2) {
            d[getp(i,j)] = h ? d[getp(i,j)] + d[s] : INF;
            vis[getp(i,j)] = 0;
        }
    d[s] = 0; q.push(s);
    while (!q.empty()) {
        int u = q.top(); q.pop();
        if (vis[u]) continue; vis[u] = 1;
        for(int i = f[u]; i; i = e[i].next) {
            int v = e[i].v;
            int x = (v-1) / m + 1,y = (v-1) % m + 1;
            if (vis[v] || x < x1 || x > x2 || y < y1 || y > y2 || d[u] + e[i].w >= d[v]) continue;
            d[v] = d[u] + e[i].w; q.push(v);
        }
    }
}

过不了


by 越学越掂 @ 2018-08-15 16:19:08

@jeffyang 那么长不一定有人看

要是加上直播女装可能会好一点


by jeffqi @ 2018-11-14 13:11:40

请问有神犇能帮帮忙吗QAQ


|