Submission #1061314

# Submission time Handle Problem Language Result Execution time Memory
1061314 2024-08-16T07:59:59 Z KasymK Cyberland (APIO23_cyberland) C++17
8 / 100
233 ms 8788 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;
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]});
    }
    memset(vis, 0, sizeof vis);
    memset(d, -1, sizeof d);
    queue<int> q;
    q.push(0);
    vis[0] = 1;
    d[0] = 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;
                if(!arr[i])
                    d[i] = 0;
                q.push(i);
            }
    }
    double answer = 0;
    answer += d[h];
    for(int i = 0; i <= n; ++i)
        adj[i].clear();
    return answer;
}
 
// int main(){
//     double kk = solve(5, 4, 10, 4, {0, 0, 2, 2}, {1, 2, 3, 4}, {6, 5, 7, 8}, {1, 0, 0, 1, 1});
//     printf("%f\n", kk);
//     return 0;
// }
# Verdict Execution time Memory Grader output
1 Incorrect 233 ms 3928 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 4956 KB Correct.
2 Correct 19 ms 3928 KB Correct.
3 Correct 18 ms 3932 KB Correct.
4 Correct 28 ms 3932 KB Correct.
5 Correct 17 ms 3936 KB Correct.
6 Correct 25 ms 4444 KB Correct.
7 Correct 23 ms 4440 KB Correct.
8 Correct 8 ms 5212 KB Correct.
9 Correct 38 ms 3932 KB Correct.
10 Correct 37 ms 3932 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 4944 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 8788 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4856 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4956 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4696 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 4444 KB Wrong Answer.
2 Halted 0 ms 0 KB -