답안 #400057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
400057 2021-05-07T09:34:33 Z victoriad 꿈 (IOI13_dreaming) C++14
0 / 100
43 ms 10200 KB
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
#include "dreaming.h"
void dfs(vector<int>&con,vector<vector<pair<int,int> > >&g,int nodo){
    con[nodo]=1;
    for(pair<int,int>c: g[nodo]){
        if(con[c.first]==0){
            dfs(con,g,c.first);
        }
    }
}
int menormayor(vector<int>&con,vector<vector<pair<int,int> > >&g,int n){
    int f=1e9,s=1e9;
    for(int i=0;i<n;i++){
        if(con[i]==1){
            int a=0;
            vector<int>d(n,1e9);
            queue<int>cola;
            cola.push(i);
            d[i]=0;
            while(!cola.empty()){
                int na=cola.front();
                cola.pop();
                for(pair<int,int> c: g[na]){
                    if(d[c.first]>d[na]+c.second){
                        d[c.first]=d[na]+c.second;
                        if(d[c.first]>a)a=d[c.first];
                        cola.push(c.first);
                    }
                }
            }
            if(a<f)f=a;
        }
        else{
            int a=0;
            vector<int>d(n,1e9);
            queue<int>cola;
            cola.push(i);
            d[i]=0;
            while(!cola.empty()){
                int na=cola.front();
                cola.pop();
                for(pair<int,int> c: g[na]){
                    if(d[c.first]>d[na]+c.second){
                        d[c.first]=d[na]+c.second;
                        if(d[c.first]>a)a=d[c.first];
                        cola.push(c.first);
                    }
                }
            }
            if(a<s)s=a;
        }
        return s+f;
    }
}
int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
    vector<vector<pair<int,int> > >g(N);
    vector<int>con(N,0);
    for(int i=0;i<N;i++){
        int a=A[i],b=B[i],c=T[i];
        g[a].push_back(make_pair(b,c));
        g[b].push_back(make_pair(a,c));
    }
    if(M==N-2){
        dfs(con,g,0);
        
    }
    return 42;
}

Compilation message

dreaming.cpp: In function 'int menormayor(std::vector<int>&, std::vector<std::vector<std::pair<int, int> > >&, int)':
dreaming.cpp:64:1: warning: control reaches end of non-void function [-Wreturn-type]
   64 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 10200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 10200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 6764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 10200 KB Output isn't correct
2 Halted 0 ms 0 KB -