Submission #163514

# Submission time Handle Problem Language Result Execution time Memory
163514 2019-11-13T17:05:04 Z kostia244 Dreaming (IOI13_dreaming) C++17
0 / 100
62 ms 12024 KB
#define _GLIBCXX_DEBUG
#include "dreaming.h"
#include<bits/stdc++.h>
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
using vvpi = vector<vpi>;
int n;
vvpi g;
vi diams, comp;
bitset<5000> vis;
void dc(int v) {
	comp.pb(v);
	vis.set(v);
	for(auto i : g[v])
		if(!vis.test(i.first)) dc(i.first);
}
ll dfs(int v, int p) {
	ll x=0;
	for(auto i : g[v])
		if(i.first!=p) x = max(x, i.second+dfs(i.first, v));
	return x;
}
int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
	n = N;
	g.resize(n);
	ll ans = 0;
	for(int f, t, c, i = 0; i < M; i++) {
		f = A[i], t = B[i], c = T[i];
		g[f].pb({t, c});
		g[t].pb({f, c});
//		cout <<f << " " <<t << "\n";
	}
	return 18;
	for(int i = 0; i < n; i++) {
		if(!vis[i]) {
			comp.clear();
			dc(i);
			ll d = LLONG_MAX;
			for(auto j : comp)
				d = min(d, dfs(j, j));
			diams.pb(d);
		}
	}
	sort(rall(diams));
	if(diams.size()==1)ans=diams[0];
	else ans = diams[0]+L+diams[1];
	if(diams.size()>2) ans = max(ans, diams[2]+L+L+diams[1]);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 12024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 12024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 12024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 8184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 12024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 12024 KB Output isn't correct
2 Halted 0 ms 0 KB -