# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
415585 |
2021-06-01T08:55:35 Z |
조영욱(#7635) |
Escape Route (JOI21_escape_route) |
C++17 |
|
717 ms |
136904 KB |
#include "escape_route.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
typedef pair<long long,long long> P;
typedef pair<int,P> iP;
vector<iP> adj[40];
long long dist[40];
bool vis[40];
void dijkstra(int st,int t) {
priority_queue<P,vector<P>,greater<P>> pq;
for(int i=0;i<n;i++) {
dist[i]=1e16;
vis[i]=true;
}
pq.push(P(t,st));
dist[st]=t;
while (!pq.empty()) {
int now;
do {
now=pq.top().second;
pq.pop();
} while (!pq.empty()&&vis[now]);
if (vis[now]) {
break;
}
vis[now]=true;
for(int i=0;i<adj[now].size();i++) {
int nt=adj[now][i].first;
long long d=dist[now]+adj[now][i].second.first;
if (d<=adj[now][i].second.second) {
dist[nt]=d;
pq.push(P(dist[nt],nt));
}
}
}
}
vector<long long> calculate_necessary_time(
int N, int M, long long S, int Q, vector<int> A, vector<int> B,
std::vector<long long> L, std::vector<long long> C, std::vector<int> U,
std::vector<int> V, std::vector<long long> T) {
n=N;
m=M;
for(int i=0;i<m;i++) {
adj[A[i]].push_back(iP(B[i],P(L[i],C[i])));
adj[B[i]].push_back(iP(A[i],P(L[i],C[i])));
}
int q=T.size();
vector<long long> ret;
for(int i=0;i<q;i++) {
dijkstra(U[i],T[i]);
ret.push_back(dist[V[i]]);
}
return ret;
}
Compilation message
escape_route.cpp: In function 'void dijkstra(int, int)':
escape_route.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for(int i=0;i<adj[now].size();i++) {
| ~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
64956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
717 ms |
136904 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
64956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
64956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
64956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |