#include<bits/stdc++.h>
#include "crocodile.h"
#define MAX_N 1005
#define oo (1<<28);
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];
bool DFS(int dugum, int maliyet, int ata) {
if(kapi[dugum]) return 1;
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;
if (DFS(v, maliyet+m, dugum)) {
// printf("Kontrol\n");
if (maliyet+m < enIyi) {
enIyi2 = enIyi;
enIyi = maliyet+m;
}
else
enIyi2 = min(enIyi2, maliyet+m);
}
}
sonuc = min(sonuc, enIyi2);
return 0;
}
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;
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.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;
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
119428 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Memory limit exceeded |
33 ms |
262144 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
379 ms |
250500 KB |
Execution killed because of forbidden syscall gettid (186) |
2 |
Halted |
0 ms |
0 KB |
- |