Submission #980109

# Submission time Handle Problem Language Result Execution time Memory
980109 2024-05-11T23:47:38 Z vjudge1 Closing Time (IOI23_closing) C++17
0 / 100
72 ms 21736 KB
#include "closing.h"
#include <bits/stdc++.h>
    
#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define INF64 ((ll) 1 << 60)
#define INF32 ((ll) 1 << 30)
#define uset unordered_set
#define umap unordered_map 
#define pqueue priority_queue
    
using namespace std;

struct Road {
    ll i, w;
};
bool operator < (const Road& a, const Road& b) {
    return a.w > b.w;
}

ll ans, k;
vector<vector<Road>> adj;
vector<ll> close;

void dijkstra(ll X, ll Y) {
    pqueue<Road> pq;
    pq.push({X, 0});
    pq.push({Y, 0});

    Road t;
    while (!pq.empty()) {
        t = pq.top(); pq.pop();
        
        if (k - t.w < 0)
            return;

        close[t.i] = t.w;
        ans += t.w;
        k -= t.w;
        for (Road& k : adj[t.i]) {
            Road nt = {k.i, t.w + k.w};
            if (close[k.i] == -1)
                pq.push(nt);
        }
    }
}

int max_score(int N, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W) {
    close.resize(N, -1);
    adj.resize(N);
    k = K;

    range(i, 0, N-1) {
        adj[U[i]].push_back({V[i], W[i]});
        adj[V[i]].push_back({U[i], W[i]});
    }

    dijkstra(X, Y);
    return ans;
} 
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 21736 KB 1st lines differ - on the 1st token, expected: '451', found: '-109466278'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -