답안 #709122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
709122 2023-03-13T06:33:19 Z ono_de206 악어의 지하 도시 (IOI11_crocodile) C++14
46 / 100
5 ms 2900 KB
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;

#define pb push_back

const int inf = 1e9 + 10;
const int mxn = 1e5 + 10;
int a[mxn], is[mxn], n;
vector<pair<int, int>> g[mxn];
map<int, int> mp;

int solve(int x) {
  if(mp.find(x) != mp.end()) return mp[x];
  vector<int> tmp;
  int &ret = mp[x];
  ret = inf;
  for(auto [y, t] : g[x]) {
    tmp.pb(solve(y) + t);
  }
  sort(tmp.begin(), tmp.end());
  ret = tmp[1];
  return ret;
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
  n = N;
  for(int i = 0; i < M; i++) {
    int x = R[i][0];
    int y = R[i][1];
    g[x].pb({y, L[i]});
    g[y].pb({x, L[i]});
  }
  for(int i = 0; i < K; i++) {
    is[P[i]] = 1;
  }
  return solve(0);
}


Compilation message

crocodile.cpp: In function 'int solve(int)':
crocodile.cpp:18:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |   for(auto [y, t] : g[x]) {
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 3 ms 2804 KB Output is correct
5 Correct 2 ms 2772 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 3 ms 2772 KB Output is correct
8 Correct 3 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 3 ms 2804 KB Output is correct
5 Correct 2 ms 2772 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 3 ms 2772 KB Output is correct
8 Correct 3 ms 2772 KB Output is correct
9 Incorrect 5 ms 2900 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 3 ms 2804 KB Output is correct
5 Correct 2 ms 2772 KB Output is correct
6 Correct 3 ms 2772 KB Output is correct
7 Correct 3 ms 2772 KB Output is correct
8 Correct 3 ms 2772 KB Output is correct
9 Incorrect 5 ms 2900 KB Output isn't correct
10 Halted 0 ms 0 KB -