Submission #1062054

# Submission time Handle Problem Language Result Execution time Memory
1062054 2024-08-16T17:49:56 Z KasymK Cyberland (APIO23_cyberland) C++17
0 / 100
91 ms 8792 KB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 1e5+5;
const int INF = 1e8;
vector<pii> adj[N];
ll d[N];
int vis[N];

double solve(int n, int m, int k, int h, vector<int> u, vector<int> v, vector<int> w, vector<int> arr){
    for(int i = 0; i < m; ++i){
        adj[u[i]].pb({v[i], w[i]});
        adj[v[i]].pb({u[i], w[i]});
    }
    for(int i = 0; i <= n; ++i)
        vis[i] = 0, d[i] = -1;
    queue<int> q;
    q.push(h);
    vis[h] = 1;
    d[h] = 0;
    while(!q.empty()){
        int x = q.front();
        q.pop();
        for(auto [i, val] : adj[x])
            if(!vis[i]){
                vis[i] = 1;
                d[i] = d[x]+val;
                q.push(i);
            }
    }
    double answer = 0;
    answer += d[0];
    for(int i = 0; i < n; ++i)
        if(arr[i] == 0)
            umin(answer, (double)d[i]);
    return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 4536 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5716 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 5976 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 8792 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 5980 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5976 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 5968 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 5980 KB Wrong Answer.
2 Halted 0 ms 0 KB -