답안 #285842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285842 2020-08-29T16:24:24 Z kevlee 악어의 지하 도시 (IOI11_crocodile) C++17
0 / 100
2 ms 2688 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
vp edges[100005];
int n, m;
int dfs(int x, int p) {
  int minn = INT_MAX, secondmin = INT_MAX;
  for (auto edge: edges[x]) {
    if (edge.fi != p) {
      int child = dfs(edge.fi, x) + edge.se;
      if (child < minn) {
        secondmin = minn;
        minn = child;
      } else if (child < secondmin) {
        secondmin = child;
      }
    }
  }
  return secondmin;
}
int travel_plan(int N, int M, int r[][2], int l[], int K, int P[]) {
  FOR(i, 0, m-1) {
    edges[r[i][0]].emplace_back(r[i][1], l[i]);
    edges[r[i][1]].emplace_back(r[i][0], l[i]);
  }
  return dfs(0, -1);
}


# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2688 KB Output isn't correct
2 Halted 0 ms 0 KB -