답안 #991731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991731 2024-06-03T03:28:01 Z stdfloat 봉쇄 시간 (IOI23_closing) C++17
8 / 100
101 ms 27564 KB
#include <bits/stdc++.h>
#include "closing.h"
using namespace std;

using ll = long long;

int max_score(int n, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W) {
    vector<vector<pair<int, int>>> E(n);
    for (int i = 0; i < n - 1; i++) {
        E[U[i]].push_back({V[i], W[i]});
        E[V[i]].push_back({U[i], W[i]});
    }

    vector<ll> v;
    for (auto st : {X, Y}) {
        queue<int> q;
        vector<ll> dis(n, -1);
        q.push(st); dis[st] = 0;
        while (!q.empty()) {
            auto x = q.front(); q.pop();

            for (auto [i, w] : E[x]) {
                if (dis[i] == -1) {
                    dis[i] = dis[x] + w;
                    q.push(i);
                }
            }
        }

        for (auto i : dis)
            if (i != -1) v.push_back(i);
    }

    sort(v.begin(), v.end());

    ll sm = 0;
    for (int i = 0; i <= (int)v.size(); i++)
        if (i == (int)v.size() || (sm += v[i]) > K) return i;
}

Compilation message

closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:8:39: warning: control reaches end of non-void function [-Wreturn-type]
    8 |     vector<vector<pair<int, int>>> E(n);
      |                                       ^
# 결과 실행 시간 메모리 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 101 ms 27300 KB Output is correct
2 Correct 97 ms 27564 KB Output is correct
3 Correct 66 ms 5456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 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 -