답안 #980101

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980101 2024-05-11T23:39:33 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
8 / 100
71 ms 22096 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;

const ll MAXN = 2E5+16;
vector <pair <ll, ll> > adj[MAXN];

int max_score (int n, int u1, int u2, ll k, vi u, vi v, vi w) {
    fill(adj, adj+n, vector <pair <ll, ll> > ({}));
    for (ll i = 0; i < n-1; i++) {
        adj[u[i]].push_back({ v[i], w[i] });
        adj[v[i]].push_back({ u[i], w[i] });
    }
    vll dis(n);
    vector <char> vis(n, false);
    priority_queue <pair <ll, ll> > pq;
    dis[u1] = 0;
    dis[u2] = 0;
    pq.push({ 0, u1 });
    pq.push({ 0, u2 });
    ll ans = 0;
    while (pq.size()) {
        ll u = pq.top().second; pq.pop();
        if (k-dis[u] < 0) break;
        k -= dis[u];
        vis[u] = true;
        ans++;
        for (auto [v, w] : adj[u]) {
            if (vis[v]) continue;
            dis[v] = dis[u]+w;
            pq.push({ -dis[v], v });
        }
    }
    return int(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 21844 KB Output is correct
2 Correct 71 ms 22096 KB Output is correct
3 Correct 43 ms 7508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 1 ms 4956 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
3 Halted 0 ms 0 KB -