Submission #415589

# Submission time Handle Problem Language Result Execution time Memory
415589 2021-06-01T08:59:52 Z 조영욱(#7635) Escape Route (JOI21_escape_route) C++17
0 / 100
9000 ms 111980 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,long long t) {
    priority_queue<P,vector<P>,greater<P>> pq;
    for(int i=0;i<n;i++) {
        dist[i]=1e16;
        vis[i]=false;
    }
    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, long long 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 43 ms 65020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9049 ms 111980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 65020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 65020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 65020 KB Output isn't correct
2 Halted 0 ms 0 KB -