Submission #1305461

#TimeUsernameProblemLanguageResultExecution timeMemory
1305461aaaaaaaaClosing Time (IOI23_closing)C++20
Compilation error
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; }

Compilation message (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