답안 #1059643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1059643 2024-08-15T06:40:25 Z tolbi 봉쇄 시간 (IOI23_closing) C++17
8 / 100
67 ms 24656 KB
#include "closing.h"

#include <bits/stdc++.h>
using namespace std;

int max_score(int N, int X, int Y, long long K,
  std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    vector<vector<pair<int,long long>>> arr(N);
    for (int i = 0; i < N-1; i++){
        arr[U[i]].push_back({V[i],W[i]});
        arr[V[i]].push_back({U[i],W[i]});
    }
    priority_queue<array<long long,3>,vector<array<long long,3>>,greater<array<long long,3>>> pq;
    pq.push({0,X,1});
    pq.push({0,Y,0});
    int say = 0;
    vector<int> vis(N,0);
    while (pq.size()){
        int node = pq.top()[1];
        long long w = pq.top()[0];
        int flag = pq.top()[2];
        pq.pop();
        if (vis[node]&(1<<flag)) continue;
        vis[node]+=(1<<flag);
        if (K<w) break;
        say++;
        K-=w;
        for (auto it : arr[node]){
            pq.push({w+it.second,it.first,flag});
        }
    }
    return say;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 20968 KB Output is correct
2 Correct 67 ms 24656 KB Output is correct
3 Correct 48 ms 5264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -