답안 #1069893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069893 2024-08-22T09:44:34 Z MohamedFaresNebili 봉쇄 시간 (IOI23_closing) C++17
8 / 100
64 ms 21140 KB
#include <bits/stdc++.h>
#include "closing.h"

        using namespace std;

        vector<pair<int, int>> adj[200005];
        int D[200005];

        int max_score(int N, int X, int Y, long long K,
            vector<int> U, vector<int> V, vector<int> W) {
            for(int l = 0; l < N; l++) D[l] = 1e9 + 7, adj[l].clear();
            for(int l = 0; l < N - 1; l++) {
                adj[U[l]].push_back({V[l], W[l]});
                adj[V[l]].push_back({U[l], W[l]});
            }
            priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
            pq.push({0, X}); pq.push({0, Y});
            D[X] = D[Y] = 0;
            int res = 0; long long cur = 0;
            while(!pq.empty()) {
                int A = pq.top().second;
                long long B = pq.top().first; pq.pop();
                if(cur + B > K) break;
                cur += B; res++;
                for(auto u : adj[A]) {
                    if(D[u.first] > D[A] + u.second) {
                        D[u.first] = D[A] + u.second;
                        pq.push({D[u.first], u.first});
                    }
                }
            }
            return res;
        }
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 18004 KB Output is correct
2 Correct 57 ms 21140 KB Output is correct
3 Correct 33 ms 10588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 5724 KB Output is correct
2 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5724 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -