Submission #880320

# Submission time Handle Problem Language Result Execution time Memory
880320 2023-11-29T07:24:43 Z Mardonbekhazratov Cyberland (APIO23_cyberland) C++17
8 / 100
22 ms 6412 KB
#include "cyberland.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;

double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
    vector<vector<pair<int,int>>>v(N);
    for(int i=0;i<N-1;i++){
        v[x[i]].push_back({y[i],c[i]});
        v[y[i]].push_back({x[i],c[i]});
    }
    vector<bool>vis(N,0);
    queue<pair<int,double>>q;
    q.push({0,0.0});
    while(!q.empty()){
        pair<int,double>p=q.front();
        q.pop();
        vis[p.first]=true;
        if(p.first==H){
            return p.second;
        }
        for(auto [z,y]:v[p.first]){
            if(!vis[z]) q.push({z,p.second+y});
        }
    }
}

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:7:37: warning: control reaches end of non-void function [-Wreturn-type]
    7 |     vector<vector<pair<int,int>>>v(N);
      |                                     ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1372 KB Correct.
2 Correct 19 ms 1628 KB Correct.
3 Correct 18 ms 1372 KB Correct.
4 Correct 22 ms 1620 KB Correct.
5 Correct 19 ms 1572 KB Correct.
6 Correct 16 ms 2032 KB Correct.
7 Correct 19 ms 2232 KB Correct.
8 Correct 8 ms 2652 KB Correct.
9 Correct 19 ms 1388 KB Correct.
10 Correct 18 ms 1324 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1372 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 6412 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -