Submission #234071

# Submission time Handle Problem Language Result Execution time Memory
234071 2020-05-22T23:27:19 Z tleontest1 Dreaming (IOI13_dreaming) C++14
0 / 100
1000 ms 12024 KB
#include <dreaming.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=0;i<N;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 2000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 100005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t[li],l,mx[li],maxi,say,mn[li];
int cev;
string s;
int ok[li];
vector<PII> v[li];

inline void dfs(int node,int ata,int der,int basla){
	//~ cout<<node<<" : : "<<ata<<endl;
	for(int i=0;i<(int)v[node].size();i++){
		int go=v[node][i].fi;
		int co=v[node][i].se;
		if(go==ata)continue;
		dfs(go,node,der+co,basla);
	}
	if(basla==0)ok[node]=1;
	mx[basla]=max(mx[basla],der);
	maxi=max(maxi,mx[basla]);
}

int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
	
	for(int i=1;i<=M;i++){
		v[A[i]].pb(mp(B[i],T[i]));
		v[B[i]].pb(mp(A[i],T[i]));
	}
	FOR{
		mn[i]=inf;
		if(!ok[i])say++;
		dfs(i,-1,0,i);
	}
	FOR{
		mn[ok[i]]=min(mn[ok[i]],mx[i]);
	}
	cev=0;
	for(int i=1;i<=say;i++){
		cev+=mn[i];
	}
    return max(maxi,cev+L*(say-1));
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 12024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 12024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 12024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 5760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 12024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 12024 KB Time limit exceeded
2 Halted 0 ms 0 KB -