답안 #1007958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007958 2024-06-26T03:20:23 Z 12345678 봉쇄 시간 (IOI23_closing) C++17
8 / 100
74 ms 25528 KB
#include "closing.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=2e5+5;

vector<pair<ll, ll>> d[nx];

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++) d[i].clear();
    for (int i=0; i<U.size(); i++) d[U[i]].push_back({V[i], W[i]}), d[V[i]].push_back({U[i], W[i]});
    int res=0;
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
    vector<ll> vs(N);
    vs[X]=vs[Y]=1;
    pq.push({0, X});
    pq.push({0, Y});
    while (!pq.empty())
    {
        auto [a, u]=pq.top();
        pq.pop();
        if (a>K) break;
        K-=a;
        res++;
        vs[u]=1;
        for (auto [v, w]:d[u]) if (!vs[v]) pq.push({a+w, v}); 
    } 
    return res;
}

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:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0; i<U.size(); i++) d[U[i]].push_back({V[i], W[i]}), d[V[i]].push_back({U[i], W[i]});
      |                   ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 25248 KB Output is correct
2 Correct 60 ms 25528 KB Output is correct
3 Correct 34 ms 10076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Incorrect 2 ms 4956 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4952 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -