제출 #670501

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6705012022-12-09 10:49:02Quan2003Robot (JOI21_ho_t4)C++17
24 / 100
1012 ms139872 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz=5e5+1;
const long long bignum = 1e18;
int n,x,k,i,j,w,m;
int movex[4]={0,0,1,-1};
int movey[4]={-1,1,0,0};
map<long long,int>dpx[sz];
long long dp[sz];
map<int,long long>col[sz];
map<int,vector<pair<pair<int,int>,long long>>>adj[sz];
void dijsktra(int src){
using T = pair<long long,pair<int,int>>;
priority_queue<T,vector<T>,greater<T>>pq;
pq.push({0,{src,0}});
for(int i = 1; i <= n; i++) dp[i] = bignum;
dp[src] = 0;
while(pq.size()){
long long x; pair<int,int>v;
tie(x,v) = pq.top(); pq.pop();
if(v.second){
if(dpx[v.first][v.second] != x) continue;
for(auto c : adj[v.first][v.second]){
long long cost = x + col[v.first][v.second] - c.second;
if(cost < dp[c.first.first]){
dp[c.first.first] = cost ;
pq.push({dp[c.first.first],{c.first.first,0}});
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...