답안 #896912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
896912 2024-01-02T11:00:35 Z ErJ 봉쇄 시간 (IOI23_closing) C++17
8 / 100
77 ms 23888 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<pair<ll, ll>>
#define pp pair<ll, ll>
#define qi queue<ll>
#define qp queue<pp>
#define pqi priority_queue<ll>
#define pqp priority_queue<pp>
#define mi map<ll, ll>
#define mpi map<pp, ll>
#define mip map<ll, pp>
#define mpp map<pp, pp>
#define mb map<ll, bool>
#define si set<ll>
#define sp set<pp>
#define mod 1000000007
#define rep(a, b) for(int a = 0; a < (b); a++)
#define inf 10000000000

int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int>  V, vector<int> W) {
    vector<vector<pair<ll, ll>>> edges(N); // kam, delka
    rep(i, U.size()) {
        edges[U[i]].push_back({ V[i], W[i] });
        edges[V[i]].push_back({ U[i], W[i] });
    }
    vb was(N);
    rep(i, N) was[i] = false;
    pqp pq;
    ll ans = 0;
    ll K2 = K;
    pq.push({ 0, X });
    pq.push({ 0, Y });
    while (!pq.empty()) {
        ll u = pq.top().second;
        ll du = -pq.top().first;
        pq.pop();
        if (was[u]) continue;
        was[u] = true;
        if (K2 < du) {
            break;
        }
        K2 -= du;
        ans++;
        for (int i = 0; i < edges[u].size(); i++) {
            ll v = edges[u][i].first;
            if (!was[v]) {
                pq.push({ -(du + edges[u][i].second), v });
            }
        }
    }
    return ans;
}

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:25:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 | #define rep(a, b) for(int a = 0; a < (b); a++)
      |                                    ^
closing.cpp:30:5: note: in expansion of macro 'rep'
   30 |     rep(i, U.size()) {
      |     ^~~
closing.cpp:52:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         for (int i = 0; i < edges[u].size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 77 ms 23520 KB Output is correct
2 Correct 75 ms 23888 KB Output is correct
3 Correct 55 ms 5456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 604 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
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 -