답안 #122626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
122626 2019-06-28T19:54:47 Z ekrem 꿈 (IOI13_dreaming) C++
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define coc g[node][i].st
#define yol g[node][i].nd
#define inf 1000000000000000007
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < ll , ll > ii;
#include "dreaming.h"


ll dp[N], u[N], k;
ii c[N];
ii mn, mx;
vector < ii > g[N];

void hazirla(ll node, ll par){
	for(ll i = 0; i < g[node].size(); i++){
		if(coc == par)
			continue;
		hazirla(coc, node);
		dp[node] = max(dp[node], dp[coc] + yol);
	}
}

void dfs(ll node, ll us){
	u[node] = 1;
	mn = min(mn, mp(max(us, dp[node]), node) );
	multiset < ll > s;
	s.insert(0);
	for(ll i = 0; i < g[node].size(); i++){
		if(u[coc])
			continue;
		s.insert(dp[coc] + yol);
	}

	for(ll i = 0; i < g[node].size(); i++){
		if(u[coc])
			continue;
		s.erase(s.find(dp[coc] + yol));
		dfs(coc, max(us + yol, *s.rbegin() + yol));
		s.insert(dp[coc] + yol);
	}
}

void bul(ll node, ll par, ll yoll){
	mx = max(mx, mp(yoll, node));
	for(ll i = 0; i < g[node].size(); i++)
		if(coc != par)
			bul(coc, node, yoll + yol);
}

ll travelTime(ll n, ll m, ll l, ll a[], ll b[], ll t[]) {
	for(ll i = 0; i < m; i++){
		a[i]++;b[i]++;
		g[a[i]].pb(mp(b[i], t[i]));
		g[b[i]].pb(mp(a[i], t[i]));
	}
	// multiset < ll > s;
	for(ll i = 1; i <= n; i++)
		if(!u[i]){
			mn.st = inf;
			hazirla(i, 0);
			dfs(i, 0);
			c[++k] = mn;
			// cout << mn.st << " " << mn.nd << endl;
		}
	sort(c + 1, c + k + 1);
	for(ll i = 1; i < k; i++){
		g[c[i].nd].pb(mp(c[k].nd, l));
		g[c[k].nd].pb(mp(c[i].nd, l));
		// cout << "AMK" << k << "AMK" << endl;
	}
	mx = mp(-inf, 0);
	bul(1, 0, 0);
	ll git = mx.nd;
	mx = mp(-inf, 0);
	bul(git, 0, 0);
	return mx.st;
	// mn = inf;
	// for(ll i = 1; i <= k; i++){
	// 	s.erase(s.find(c[i]));
	// 	mn = min(mn, c[i] + *s.rbegin() + l);
	// 	s.insert(c[i]);
	// }
	return 0;
}

Compilation message

dreaming.cpp:9:11: error: expected ',' or '...' before numeric constant
 #define N 1000005
           ^
dreaming.h:8:20: note: in expansion of macro 'N'
 int travelTime(int N, int M, int L, int A[], int B[], int T[]);
                    ^
dreaming.cpp: In function 'void hazirla(ll, ll)':
dreaming.cpp:23:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll i = 0; i < g[node].size(); i++){
                ~~^~~~~~~~~~~~~~~~
dreaming.cpp: In function 'void dfs(ll, ll)':
dreaming.cpp:36:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll i = 0; i < g[node].size(); i++){
                ~~^~~~~~~~~~~~~~~~
dreaming.cpp:42:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll i = 0; i < g[node].size(); i++){
                ~~^~~~~~~~~~~~~~~~
dreaming.cpp: In function 'void bul(ll, ll, ll)':
dreaming.cpp:53:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ll i = 0; i < g[node].size(); i++)
                ~~^~~~~~~~~~~~~~~~