제출 #1305461

#제출 시각아이디문제언어결과실행 시간메모리
1305461aaaaaaaa봉쇄 시간 (IOI23_closing)C++20
컴파일 에러
0 ms0 KiB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;

const int mxN = 2e5 + 100;

vector<pair<int, int>> adj[mxN];

int max_score(int N, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W)
{
    for(int i = 0; i <= N; ++i) adj[i].clear();

    for(int i = 1; i <= N; ++i){
        adj[U[i]].push_back({V[i], W[i]});
        adj[V[i]].push_back({U[i], W[i]});
    }

    queue<pair<long long, int>> q;

    pq.push({0, X}), pq.push({0, Y});

    vector<bool> vis(N + 5, 0);

    vis[X] = vis[Y] = 1;

    int ans = 0;

    vector<long long> dist;

    while(q.size()){
        auto tp = q.front();
        q.pop();
        dist.push_back(tp.first);
        vis[tp.second] = 1;
        for(auto it : adj[tp.second]){
            if(!vis[it.first]){
                pq.push({(long long) it.second + tp.first, it.second});
                vis[it.first] = 1;
            }
        }
    }

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

    for(auto it : dist){
        K -= it;
        if(K < 0) break;
        ans += 1;
    }

    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:20:5: error: 'pq' was not declared in this scope; did you mean 'q'?
   20 |     pq.push({0, X}), pq.push({0, Y});
      |     ^~
      |     q