답안 #220518

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
220518 2020-04-08T03:24:49 Z anonymous 악어의 지하 도시 (IOI11_crocodile) C++14
89 / 100
407 ms 40748 KB
#include "crocodile.h"
#include <iostream>
#include <vector>
#define MAXN 1005
using namespace std;
vector<pair<int,int> > adj[MAXN];
int dp[MAXN];
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
  for (int i=0; i<N; i++) {
    dp[i] = 1e9 + 10;
  }
  for (int i=0; i<K; i++) {
    dp[P[i]]=0;
  }
  for (int i=0; i<M; i++) {
        adj[R[i][0]].push_back({R[i][1], L[i]});
        adj[R[i][1]].push_back({R[i][0], L[i]});
  }
  for (int j=0; j<N; j++) {
    for (int i=0; i<N; i++) {
        int Min=1e9 + 10, Smin = 1e9+10;
        for (auto v: adj[i]) {
            if (dp[v.first] + v.second < Min) {
                Smin = Min;
                Min = dp[v.first] + v.second;
            } else if (dp[v.first] + v.second < Smin) {
                Smin = dp[v.first] + v.second;
            }
        }
        dp[i] = min(dp[i], Smin);
    }
  }
  return(dp[0]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 13 ms 512 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 13 ms 512 KB Output is correct
8 Correct 16 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 13 ms 512 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 13 ms 512 KB Output is correct
8 Correct 16 ms 512 KB Output is correct
9 Correct 10 ms 640 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 8 ms 512 KB Output is correct
12 Correct 15 ms 768 KB Output is correct
13 Correct 12 ms 896 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 9 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 13 ms 512 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 13 ms 512 KB Output is correct
8 Correct 16 ms 512 KB Output is correct
9 Correct 10 ms 640 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 8 ms 512 KB Output is correct
12 Correct 15 ms 768 KB Output is correct
13 Correct 12 ms 896 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 9 ms 512 KB Output is correct
16 Runtime error 407 ms 40748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -