Submission #1037726

#TimeUsernameProblemLanguageResultExecution timeMemory
1037726fv3Closing Time (IOI23_closing)C++17
8 / 100
79 ms26196 KiB
#include "closing.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1ll << 60ll; int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) { vector<vector<pair<int, ll>>> adj(N); for (int i = 0; i < U.size(); i++) { adj[U[i]].push_back({V[i], W[i]}); adj[V[i]].push_back({U[i], W[i]}); } priority_queue<pair<ll, int>> q; q.push({0, X}); q.push({0, Y}); vector<int> visited(N); vector<ll> dist(N, INF); dist[X] = 0; dist[Y] = 0; int res = 0; while (!q.empty()) { int s = q.top().second; q.pop(); if (visited[s]) continue; visited[s] = 1; K -= dist[s]; if (K < 0) break; res++; for (auto node : adj[s]) { if (!visited[node.first] && dist[s] + node.second < dist[node.first]) { dist[node.first] = dist[s] + node.second; q.push({-dist[node.first], node.first}); } } } return res; }

Compilation message (stderr)

closing.cpp: In function 'int max_score(int, int, int, ll, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i < U.size(); i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...