Submission #308036

# Submission time Handle Problem Language Result Execution time Memory
308036 2020-09-30T00:12:45 Z daniel920712 Dreaming (IOI13_dreaming) C++14
18 / 100
56 ms 12152 KB
#include "dreaming.h"
#include <vector>
using namespace std;
vector < pair < int , int > > Next[100005];
bool have[100005]={0};
int a=-1e8,b=-1e8,c=-1e8,t=0,big=0,bb=0,where;
void F(int here,int con)
{
    if(con>=big)
    {
        big=con;
        where=here;
    }
    have[here]=1;
    for(auto i:Next[here]) if(!have[i.first]) F(i.first,con+i.second);
}
void F2(int here,int Father,int con)
{
    t=min(t,max(con,big-con));
    for(auto i:Next[here]) if(i.first!=Father) F2(i.first,here,con+i.second);
}
int travelTime(int N, int M, int L, int A[], int B[], int T[])
{
    int i;
    for(i=0;i<M;i++)
    {
        Next[A[i]].push_back(make_pair(B[i],T[i]));
        Next[B[i]].push_back(make_pair(A[i],T[i]));
    }
    for(i=0;i<N;i++)
    {
        if(!have[i])
        {
            big=0;
            where=0;
            F(i,0);
            bb=max(bb,big);
            t=1e9;
            F2(where,-1,0);
            if(t>=a)
            {
                c=b;
                b=a;
                a=t;
            }
            else if(t>=b)
            {
                c=b;
                b=t;
            }
            else if(t>=c) c=t;

        }
    }
    return max(max(bb,a+b+L),b+c+2*L);
}
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 12152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 12152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 12152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 5504 KB Output is correct
2 Correct 23 ms 5504 KB Output is correct
3 Correct 23 ms 5504 KB Output is correct
4 Correct 22 ms 5504 KB Output is correct
5 Correct 26 ms 5504 KB Output is correct
6 Correct 25 ms 5632 KB Output is correct
7 Correct 24 ms 5632 KB Output is correct
8 Correct 24 ms 5376 KB Output is correct
9 Correct 24 ms 5512 KB Output is correct
10 Correct 23 ms 5632 KB Output is correct
11 Correct 2 ms 2688 KB Output is correct
12 Correct 3 ms 2816 KB Output is correct
13 Correct 3 ms 2816 KB Output is correct
14 Correct 4 ms 2816 KB Output is correct
15 Correct 3 ms 2816 KB Output is correct
16 Correct 3 ms 2816 KB Output is correct
17 Correct 3 ms 2816 KB Output is correct
18 Correct 3 ms 2816 KB Output is correct
19 Correct 3 ms 2816 KB Output is correct
20 Correct 2 ms 2688 KB Output is correct
21 Correct 2 ms 2688 KB Output is correct
22 Correct 2 ms 2688 KB Output is correct
23 Correct 4 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 12152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 12152 KB Output isn't correct
2 Halted 0 ms 0 KB -