#ifndef akinyan #define akinyan #include using namespace std; using ch = char; using ll = long long; using ld = long double; using db = double; using st = string; using vdb = vector; using vvdb = vector; using vl = vector; using vvl = vector; using vvvl = vector; using vd = vector; using vvd = vector; using vs = vector; using vvs = vector; using vc = vector; using vvc = vector; using vb = vector; using vvb = vector; using vvvb = vector; const ll mod = 998244353; const ll MOD = 1000000007; const ll INF = 1000000000000000000LL; using pall = pair; using vp = vector; #endif struct Edge { long long to; long long cost; }; using Graph = vector>; using P = pair; void dijkstra(const Graph &G, int s, vector &dis) { int N = G.size(); dis.resize(N, INF); priority_queue, greater

> pq; // 「仮の最短距離, 頂点」が小さい順に並ぶ dis[s] = 0; pq.emplace(dis[s], s); while (!pq.empty()) { P p = pq.top(); pq.pop(); int v = p.second; if (dis[v] < p.first) { // 最短距離で無ければ無視 continue; } for (auto &e : G[v]) { if (dis[e.to] > dis[v] + e.cost) { // 最短距離候補なら priority_queue に追加 dis[e.to] = dis[v] + e.cost; pq.emplace(dis[e.to], e.to); } } } } int main(){ ll H,W,N; cin>>H>>W>>N; Graph G(N+2); vvl X(N,vl(4)); for(int i=0; i>X[i][j]; } } for(int i=0; i