답안 #305992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
305992 2020-09-24T09:06:38 Z juggernaut 꿈 (IOI13_dreaming) C++14
0 / 100
561 ms 24952 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);
    }
    if(st.size()!=2)exit(1);
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 24952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 24952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 24952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 24 ms 9892 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 24952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 561 ms 24952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -