Submission #305994

# Submission time Handle Problem Language Result Execution time Memory
305994 2020-09-24T09:07:45 Z juggernaut Dreaming (IOI13_dreaming) C++14
0 / 100
582 ms 24696 KB
#include"dreaming.h"
//#include"grader.c"
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
vector<pair<int,int>>g[100005];
int path[105],mn,idd;
bool vis[105];
void dfs(int v,int p,int depth,int glob){
    path[glob]=max(depth,path[glob]);
    mn=max(mn,depth);
    for(auto to:g[v])
    if(to.fr!=p)
        dfs(to.fr,v,depth+to.sc,glob);
}
void go(int v,int p){
    vis[v]=1;
    mn=min(mn,path[v]);
    if(path[v]<mn){
        mn=path[v];
        idd=v;
    }
    for(auto to:g[v])
    if(to.fr!=p)
        go(to.fr,v);
}
int travelTime(int n,int m,int l,int x[],int y[],int z[]){
    int i;
    for(i=0;i<m;i++){
        g[x[i]].push_back({y[i],z[i]});
        g[y[i]].push_back({x[i],z[i]});
    }
    for(i=0;i<n;i++)dfs(i,i,0,i);
    stack<int>st;
    for(i=0;i<n;i++)if(!vis[i]){
        mn=2e9;
        go(i,i);
        st.push(idd);
    }
    int xx=st.top();
    st.pop();
    int yy=st.top();
    st.pop();
    g[xx].push_back({yy,0});
    g[yy].push_back({xx,0});
    mn=0;
    for(i=0;i<n;i++)dfs(i,i,0,i);
    return mn;
}
# Verdict Execution time Memory Grader output
1 Runtime error 582 ms 24696 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 582 ms 24696 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 582 ms 24696 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 25 ms 9856 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 582 ms 24696 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 582 ms 24696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -