답안 #433274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433274 2021-06-19T12:10:22 Z MilosMilutinovic 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
2 ms 360 KB
#include "crocodile.h"
#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<pair<int, int>>> g(n);
  for (int i = 0; i < m; i++) {
    g[r[i][0]].push_back({r[i][1], l[i]});
    g[r[i][1]].push_back({r[i][0], l[i]});
  }
  const int inf = 1e9;
  vector<int> dist(n, inf);
  set<pair<int, int>> que;
  for (int i = 0; i < k; i++) {
    for (auto& e : g[p[i]]) {
      que.insert({e.second, e.first});
    }
    dist[p[i]] = 0;
  }
  vector<int> cnt(n);
  while (!que.empty()) {
    auto x = *que.begin();
    que.erase(que.begin());
    if (dist[x.second] != inf) {
      continue;
    }
    cnt[x.second]++;
    if (cnt[x.second] == 2) {
      dist[x.second] = x.first;
      for (auto& y : g[x.second]) {
        y.second += x.first;
        que.insert({y.second, y.first});
      }
    }
  }
  return dist[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Incorrect 2 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Incorrect 2 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 360 KB Output is correct
4 Incorrect 2 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -