Submission #29100

# Submission time Handle Problem Language Result Execution time Memory
29100 2017-07-18T08:52:42 Z ozaslan Crocodile's Underground City (IOI11_crocodile) C++14
46 / 100
446 ms 262144 KB
#include<bits/stdc++.h>
#include "crocodile.h"
#define MAX_N 10005
#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;
bool kapi[MAX_N];
vector< pair<int, int> > E[MAX_N];

int DFS(int dugum, int maliyet, int ata) {
	if(kapi[dugum]) return maliyet;

	int enIyi = oo;
	int enIyi2 = oo;

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

		int altMaliyet = DFS(v, maliyet+m, dugum);
//            printf("Kontrol\n");
        if ( altMaliyet < enIyi) {
            enIyi2 = enIyi;
            enIyi = altMaliyet;
        }
        else
            enIyi2 = min(enIyi2, altMaliyet);
	}

	return enIyi2;
}


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]) );
	}

	for (int i = 0; i < K; i++)
		kapi[ P[i] ] = 1;

	sonuc = DFS(0, 0, -1);

  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.1", "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;
}
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 119644 KB Output is correct
2 Correct 0 ms 119644 KB Output is correct
3 Correct 0 ms 119644 KB Output is correct
4 Correct 0 ms 119644 KB Output is correct
5 Correct 0 ms 119644 KB Output is correct
6 Correct 0 ms 119644 KB Output is correct
7 Correct 0 ms 119644 KB Output is correct
8 Correct 0 ms 119644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Memory limit exceeded 16 ms 262144 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 446 ms 120040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -