# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896912 | ErJ | Closing Time (IOI23_closing) | C++17 | 77 ms | 23888 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |