답안 #29182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
29182 2017-07-18T15:09:35 Z ozaslan 악어의 지하 도시 (IOI11_crocodile) C++14
89 / 100
789 ms 158172 KB
#include<bits/stdc++.h>
#include "crocodile.h"
#define MAX_N 50005
#define oo (1<<30);
using namespace std;



#include "crocodile.h"
#include <stdio.h>
#include <stdlib.h>
/*
#define MAX_N 50000
#define MAX_M 10000000

static int N, M;
static int R[MAX_M][2];
static int L[MAX_M];
static int K;
static int P[MAX_N];
static int solution;

inline
void my_assert(int e) {if (!e) abort();}

*/
int sonuc = oo;
int kul[MAX_N];
vector< pair<int, int> > E[MAX_N];

int djk(int K, int P[]) {

  priority_queue< pair<int, int> > Q;

  for (int i = 0; i < K; i++) {
    Q.push( make_pair(0, P[i]) );
    kul[P[i]] = 1;
  }

  while (!Q.empty()) {
    int u = Q.top().second;
    int t = -Q.top().first;
    Q.pop();

    if (kul[u] != 1) { kul[u]++; continue; }
    kul[u]++;

    if (u == 0) return t;

    int s = E[u].size();
    for (int i = 0; i < s; i++) {
      int v = E[u][i].first, m = E[u][i].second;

      if (kul[v] <= 1)
        Q.push( make_pair(-(t+m), v) );
    }

  }
  return 365;
}


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

	for (int i = 0; i < M; i++) {
		E[ R[i][0] ].push_back( make_pair(R[i][1], L[i]) );
		E[ R[i][1] ].push_back( make_pair(R[i][0], L[i]) );
	}

	sonuc = djk(K, P);

  return sonuc;
}
/*
void read_input()
{
  int i;
  my_assert(3==scanf("%d %d %d",&N,&M,&K));
  for(i=0; i<M; i++)
    my_assert(3==scanf("%d %d %d",&R[i][0],&R[i][1],&L[i]));
  for(i=0; i<K; i++)
    my_assert(1==scanf("%d",&P[i]));
  my_assert(1==scanf("%d",&solution));
}

int main()
{
    freopen("grader.in.2", "r", stdin);
  int ans;
  read_input();
  ans = travel_plan(N,M,R,L,K,P);
  if(ans==solution)
    printf("Correct.\n");
  else
    printf("Incorrect. Returned %d, Expected %d.\n",ans,solution);

  return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 120768 KB Output is correct
2 Correct 0 ms 120768 KB Output is correct
3 Correct 0 ms 120768 KB Output is correct
4 Correct 0 ms 120900 KB Output is correct
5 Correct 0 ms 120904 KB Output is correct
6 Correct 0 ms 120768 KB Output is correct
7 Correct 0 ms 120900 KB Output is correct
8 Correct 0 ms 120768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 121044 KB Output is correct
2 Correct 0 ms 120768 KB Output is correct
3 Correct 0 ms 120900 KB Output is correct
4 Correct 6 ms 121196 KB Output is correct
5 Correct 3 ms 121304 KB Output is correct
6 Correct 0 ms 120768 KB Output is correct
7 Correct 0 ms 120900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 789 ms 158172 KB Output is correct
2 Runtime error 79 ms 120768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -