답안 #952190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
952190 2024-03-23T09:20:14 Z emad234 악어의 지하 도시 (IOI11_crocodile) C++17
89 / 100
351 ms 57300 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair<int, int>
const int mod = 1e9 + 7;
const int mxN = 2e6 + 5;
using namespace std;
vector<vector<pii>> v;
int dist[mxN], mn[mxN];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
  memset(mn, -1, sizeof mn);
  v.resize(N + 2);
  for (int i = 0; i < N; i++)
  {
    dist[i] = 1e9 + 5;
  }
  for (int i = 0; i < M; i++)
  {
    v[R[i][1]].push_back({R[i][0], L[i]});
    v[R[i][0]].push_back({R[i][1], L[i]});
  }
  priority_queue<pii, vector<pii>, greater<pii>> q;
  for (int i = 0; i < K; i++)
  {
    dist[P[i]] = 0;
    q.push({0, P[i]});
  }
  while (q.size())
  {
    auto u = q.top();
    q.pop();
    if (dist[u.S] < u.F)
      continue;
    for (auto x : v[u.S])
    {
      if (dist[x.F] > x.S + u.F && mn[x.F] == -1)
      {
        mn[x.F] = x.S + u.F;
      }
      else if (dist[x.F] > x.S + u.F && mn[x.F] != -1)
      {
        int Mn = mn[x.F];
        mn[x.F] = min(x.S + u.F, Mn);
        dist[x.F] = max(x.S + u.F, Mn);
        q.push({dist[x.F], x.F});
      }
    }
  }
  return dist[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 12892 KB Output is correct
2 Correct 2 ms 12892 KB Output is correct
3 Correct 2 ms 12892 KB Output is correct
4 Correct 3 ms 12924 KB Output is correct
5 Correct 2 ms 12892 KB Output is correct
6 Correct 2 ms 12892 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 2 ms 12924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 12892 KB Output is correct
2 Correct 2 ms 12892 KB Output is correct
3 Correct 2 ms 12892 KB Output is correct
4 Correct 3 ms 12924 KB Output is correct
5 Correct 2 ms 12892 KB Output is correct
6 Correct 2 ms 12892 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 2 ms 12924 KB Output is correct
9 Correct 3 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 5 ms 13144 KB Output is correct
13 Correct 4 ms 13148 KB Output is correct
14 Correct 2 ms 12892 KB Output is correct
15 Correct 3 ms 12888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 12892 KB Output is correct
2 Correct 2 ms 12892 KB Output is correct
3 Correct 2 ms 12892 KB Output is correct
4 Correct 3 ms 12924 KB Output is correct
5 Correct 2 ms 12892 KB Output is correct
6 Correct 2 ms 12892 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 2 ms 12924 KB Output is correct
9 Correct 3 ms 12892 KB Output is correct
10 Correct 2 ms 12892 KB Output is correct
11 Correct 2 ms 12892 KB Output is correct
12 Correct 5 ms 13144 KB Output is correct
13 Correct 4 ms 13148 KB Output is correct
14 Correct 2 ms 12892 KB Output is correct
15 Correct 3 ms 12888 KB Output is correct
16 Correct 282 ms 52528 KB Output is correct
17 Correct 52 ms 23888 KB Output is correct
18 Correct 71 ms 25176 KB Output is correct
19 Correct 351 ms 57300 KB Output is correct
20 Correct 206 ms 47284 KB Output is correct
21 Correct 27 ms 17756 KB Output is correct
22 Incorrect 228 ms 44116 KB Output isn't correct
23 Halted 0 ms 0 KB -