Submission #96730

# Submission time Handle Problem Language Result Execution time Memory
96730 2019-02-11T15:14:13 Z MohamedAhmed0 Dreaming (IOI13_dreaming) C++14
0 / 100
66 ms 20472 KB
#include <bits/stdc++.h>
#include "dreaming.h"

using namespace std;

const int MAX = 1e5 + 10 ;
vector< vector< pair<int,  int> > >adjlist(MAX) ;
int comp[MAX] ;
int cnt = 0 ;
void dfs(int node , int par)
{
    comp[node] = cnt ;
    for(auto &child : adjlist[node])
    {
        if(child.first != par)
            dfs(child.first , node) ;
    }
    return ;
}

int travelTime(int N,int M,int L,int A[],int B[],int T[])
{
    cnt = 0 ;
    for(int i = 0 ; i < M ; ++i)
    {
        int x = A[i] , y = B[i] , z = T[i] ;
        adjlist[x].push_back({y , z}) ;
        adjlist[y].push_back({x , z}) ;
    }
    for(int i = 1 ; i <= N ; ++i)
    {
        if(comp[i] == 0)
        {
            ++cnt ;
            dfs(i , i) ;
        }
    }
    if(cnt > 2)
        assert(false) ;
    return -1 ;
}

# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 20472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 20472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 20472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 27 ms 10620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 20472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 66 ms 20472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -