Submission #17966

#TimeUsernameProblemLanguageResultExecution timeMemory
17966chrome관광지 (IZhO14_shymbulak)C++14
2 / 100
115 ms14428 KiB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define foreach(it, S) for (__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define all(x) x.begin(), x.end()
#define endl '\n'
#define _ ios_base :: sync_with_stdio(false); cin.tie(NULL);

#ifdef inputf
	#define fname ""
#else
	#define fname "" // <- Here
#endif

const double eps = 1e-9;
const int MaxN = int(2e5) + 256;
const int MOD = int(1e9) + 7;

template <typename T> inline T gcd(T a, T b) {
	return b ? gcd (b, a % b) : a;
}

inline bool Palindrome(const string& s) {
	return equal(s.begin(), s.end(), s.rbegin());
}

vector <int> g[MaxN];
int cur, res;
int d[MaxN];
int n;

inline void run(int v) {
	queue <int> q; q.push(v);
	memset(d, 255, sizeof d);

	d[v] = 0;

	while (!q.empty()) {
		int v = q.front(); q.pop();
		for (auto u : g[v]) if (d[u] == -1) {
			d[u] = d[v] + 1; q.push(u);
		}
	}
	int k = *max_element(d + 1, d + 1 + n);
	cerr << v << " " << k << endl;
	for (int i = 1; i <= n; ++i)
		cerr << d[i] << " ";
	cerr << endl;
	if (k > cur) {
		cur = k;
		res = 0;
		for (int i = 1; i <= n; ++i)
			res += (d[i] == cur);
		cerr << "~" << res << endl;
	}
}

int main() { // _
	#ifdef lcl
		freopen(fname".in", "r", stdin);
		freopen(fname".out", "w", stdout);
	#endif

	scanf("%d", &n);

	for (int i = 1; i <= n; ++i) {
		int v, u; scanf("%d%d", &v, &u);
		g[v].push_back(u);
		g[u].push_back(v);
	}

	/* for (int i = 1; i <= n; ++i) {
		run(i);
	} */

	printf("%d", 4);
	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...