Submission #1059046

# Submission time Handle Problem Language Result Execution time Memory
1059046 2024-08-14T16:26:44 Z vjudge1 Cyberland (APIO23_cyberland) C++17
0 / 100
56 ms 5724 KB
#include <bits/stdc++.h>

using namespace std;

int dist[100001];

void dijkstra(vector<pair<int,int>> adj[],int i)
{
    priority_queue<pair<int,int>> pq;
    pq.push({-0,i});
    dist[i]=0;
    while(pq.size()>0)
    {

        int a=-pq.top().first,b=pq.top().second;
        pq.pop();
        for(auto it : adj[b])
        {
            if(dist[it.first]==-1 || (dist[it.first]>dist[b]+it.second))
            {
                dist[it.first]=dist[b]+it.second;
                pq.push({-dist[it.first],it.first});
            }
        }
    }

}

double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int>
y, std::vector<int> c, std::vector<int> arr)
{
    memset(dist,-1,sizeof(dist));
    vector<pair<int,int>> adj[N+1];
    for(int i=0;i<x.size();i++)
    {
        int a=x[i],b=y[i],cc=c[i];
        adj[a].push_back({b,cc});
        adj[b].push_back({a,cc});
    }
    dijkstra(adj,0);
    return dist[H];

}


Compilation message

cyberland.cpp: In function 'void dijkstra(std::vector<std::pair<int, int> >*, int)':
cyberland.cpp:15:13: warning: unused variable 'a' [-Wunused-variable]
   15 |         int a=-pq.top().first,b=pq.top().second;
      |             ^
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i=0;i<x.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 856 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 860 KB Double -7.71503e+08 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 928 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 5724 KB Double -1.97523e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 860 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 860 KB Double -1.97728e+09 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 976 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 860 KB Wrong Answer.
2 Halted 0 ms 0 KB -