Submission #640558

# Submission time Handle Problem Language Result Execution time Memory
640558 2022-09-14T22:53:50 Z ymm Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
6 ms 7892 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

static const int N = 100'010;
static const int inf = 1e9;
static vector<pii> A[N];
static set<pii> adj[N];
static int dis[N];

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
	Loop (i,0,m) {
		A[r[i][0]].push_back({r[i][1], l[i]});
		A[r[i][1]].push_back({r[i][0], l[i]});
	}
	fill (dis, dis+N, inf);
	set<pii> s;
	Loop (i,0,k) {
		dis[p[i]] = 0;
		s.insert({0, p[i]});
	}
	while (s.size()) {
		auto [d, v] = *s.begin();
		s.erase(s.begin());
		for (auto [u, w] : A[v]) {
			adj[u].insert({d + w, u});
			int d2 = adj[u].size() >= 2? (++adj[u].begin())->first: inf;
			if (d2 < dis[u]) {
				s.erase({dis[u], u});
				dis[u] = d2;
				s.insert({dis[u], u});
			}
		}
	}
	return dis[0];
}


# Verdict Execution time Memory Grader output
1 Correct 6 ms 7764 KB Output is correct
2 Correct 4 ms 7728 KB Output is correct
3 Correct 5 ms 7764 KB Output is correct
4 Incorrect 5 ms 7892 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 7764 KB Output is correct
2 Correct 4 ms 7728 KB Output is correct
3 Correct 5 ms 7764 KB Output is correct
4 Incorrect 5 ms 7892 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 7764 KB Output is correct
2 Correct 4 ms 7728 KB Output is correct
3 Correct 5 ms 7764 KB Output is correct
4 Incorrect 5 ms 7892 KB Output isn't correct
5 Halted 0 ms 0 KB -