#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
7196 KB |
Output is correct |
2 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
7196 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
7196 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
7196 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
7196 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
7196 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
7328 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
10100 KB |
Output isn't correct |
2 |
Incorrect |
48 ms |
10496 KB |
Output isn't correct |
3 |
Incorrect |
48 ms |
10232 KB |
Output isn't correct |
4 |
Incorrect |
36 ms |
10364 KB |
Output isn't correct |
5 |
Incorrect |
24 ms |
10364 KB |
Output isn't correct |
6 |
Incorrect |
115 ms |
12740 KB |
Output isn't correct |
7 |
Incorrect |
85 ms |
11816 KB |
Output isn't correct |
8 |
Incorrect |
72 ms |
13532 KB |
Output isn't correct |
9 |
Incorrect |
70 ms |
13532 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
13796 KB |
Output isn't correct |
11 |
Incorrect |
77 ms |
14164 KB |
Output isn't correct |
12 |
Incorrect |
66 ms |
14428 KB |
Output isn't correct |