Submission #1059106

# Submission time Handle Problem Language Result Execution time Memory
1059106 2024-08-14T17:19:08 Z vjudge1 Cyberland (APIO23_cyberland) C++17
15 / 100
135 ms 8248 KB
#include <bits/stdc++.h>

using namespace std;

long long dist[100001];

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

        long long a=-pq.top().first,b=pq.top().second;
        pq.pop();
        for(auto it : adj[b])
        {
            if(dist[it.first]==-1 || (dist[it.first]>a+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<long long,long long>> adj[N+1];
    for(long long i=0;i<x.size();i++)
    {
        long long 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 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:34:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(long long i=0;i<x.size();i++)
      |                       ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 1616 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1884 KB Correct.
2 Correct 19 ms 1908 KB Correct.
3 Correct 18 ms 1932 KB Correct.
4 Correct 19 ms 1904 KB Correct.
5 Correct 17 ms 2128 KB Correct.
6 Correct 13 ms 2908 KB Correct.
7 Correct 25 ms 2920 KB Correct.
8 Correct 8 ms 3684 KB Correct.
9 Correct 27 ms 1872 KB Correct.
10 Correct 30 ms 1880 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1928 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 8248 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1884 KB Correct.
2 Correct 20 ms 2140 KB Correct.
3 Correct 26 ms 2132 KB Correct.
4 Correct 14 ms 2908 KB Correct.
5 Correct 35 ms 1856 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1980 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 2080 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2140 KB Wrong Answer.
2 Halted 0 ms 0 KB -