답안 #840047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840047 2023-08-31T03:04:06 Z socpite 봉쇄 시간 (IOI23_closing) C++17
8 / 100
73 ms 18652 KB
#include "closing.h"

#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const long long INF = 1e18;

int vis[maxn];
long long dep[maxn];

vector<pair<int, int>> g[maxn];

int max_score(int N, int X, int Y, long long K,
              std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    for (int i = 0; i < N; i++)
        g[i].clear();
    for (int i = 0; i < N - 1; i++)
    {
        g[U[i]].push_back({V[i], W[i]});
        g[V[i]].push_back({U[i], W[i]});
    }
    for (int i = 0; i < N; i++)
        dep[i] = INF;
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq;
    pq.push({0, X});
    pq.push({0, Y});
    dep[X] = 0;
    dep[Y] = 0;
    long long ans = 0;
    while (!pq.empty())
    {
        auto x = pq.top();
        // cout << "among " << x.first << " " << x.second << endl;
        pq.pop();
        if (x.first > K)
            break;
        K -= x.first;
        ans++;
        for (auto v : g[x.second])
        {
            if (dep[v.first] <= x.first + v.second)
                continue;
            dep[v.first] = x.first + v.second;
            pq.push({dep[v.first], v.first});
        }
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 18652 KB Output is correct
2 Correct 72 ms 18252 KB Output is correct
3 Correct 50 ms 7436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -