| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1114785 | sosuke | Crocodile's Underground City (IOI11_crocodile) | C++14 | 335 ms | 62620 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
	vector<vector<array<int, 2>>> adj(n);
	for (int i = 0; i < m; i++) {
		adj[r[i][0]].push_back({r[i][1], l[i]});
		adj[r[i][1]].push_back({r[i][0], l[i]});
	}
	// we use 1e9 instead of INT_MAX to prevent overflow
	const array<int, 2> DEF = {(int)1e9, (int)1e9};
	vector<array<int, 2>> dist(n, DEF);
	priority_queue<array<int, 2>> pq;
	for (int i = 0; i < k; i++) {
		pq.push({0, p[i]});
		dist[p[i]] = {0, 0};
	}
	while (!pq.empty()) {
		auto [time, at] = pq.top();
		pq.pop();
		time *= -1;  // undoing the negative number trick
		if (dist[at][1] < time) { continue; }
		for (const auto [nxt, weight] : adj[at]) {
			if (time + weight < dist[nxt][0]) {
				if (dist[nxt][0] < dist[nxt][1]) { pq.push({-dist[nxt][0], nxt}); }
				dist[nxt][1] = dist[nxt][0];
				dist[nxt][0] = time + weight;
			} else if (time + weight < dist[nxt][1]) {
				dist[nxt][1] = time + weight;
				pq.push({-dist[nxt][1], nxt});
			}
		}
	}
	return dist[0][1];
}
컴파일 시 표준 에러 (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... | ||||
