답안 #618877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
618877 2022-08-02T08:08:52 Z Mohammed_Atalah 악어의 지하 도시 (IOI11_crocodile) C++17
46 / 100
5 ms 2004 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<vector<int>>> edg;
map<int, int> mp;
vector<int> vis;
int dfs(int idx) {
  vector<int> v;

  for (auto &i : edg[idx]) {

    if (!vis[i[0]]) {
      vis[i[0]] = 1;
      int e = i[1];
      if (!mp[i[0]]) {
        e += dfs(i[0]);
      }
      v.push_back(e);

    }
  }

  sort(v.begin(), v.end());
  return v[1];

}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{

  edg.resize(N);
  vis.resize(N);
  for (int i = 0; i < M; i++) {
    edg[R[i][0]].push_back({R[i][1], L[i]});
    edg[R[i][1]].push_back({R[i][0], L[i]});
  }

  for (int i = 0; i < K ; i++) {
    mp[P[i]]++;
  }

  vis[0] = 1;
  return dfs(0);
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 568 KB Output is correct
9 Runtime error 5 ms 2004 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 568 KB Output is correct
9 Runtime error 5 ms 2004 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -