# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
469865 |
2021-09-02T07:18:17 Z |
1bin |
None (KOI17_cat) |
C++14 |
|
296 ms |
58184 KB |
#include <bits/stdc++.h>
#include <cassert>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 3e5 + 5;
ll n, m, a, b, dfsn[NMAX], cnt[NMAX], x[NMAX], y[NMAX], t, ans, sum;
vector<int> adj[NMAX];
void dfs(int now, int bef) {
dfsn[now] = ++t;
for (int nx : adj[now]) {
if (nx == bef) continue;
if (!dfsn[nx]) {
dfs(nx, now);
cnt[now] += cnt[nx]; x[now] += x[nx]; y[now] += y[nx];
}
else if (dfsn[nx] < dfsn[now]) {
cnt[bef]++, cnt[nx]--;
x[now]++;
}
else y[bef]++;
}
if (!y[now] && cnt[now] <= 1 && !(sum - x[now])) ans += now;
return;
}
int main(void) {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> m;
sum = m - (n - 1);
while (m--) {
cin >> a >> b;
adj[a].emplace_back(b);
adj[b].emplace_back(a);
}
dfs(1, 0);
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
7372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
235 ms |
30332 KB |
Output is correct |
2 |
Correct |
235 ms |
30264 KB |
Output is correct |
3 |
Correct |
244 ms |
30336 KB |
Output is correct |
4 |
Correct |
283 ms |
30348 KB |
Output is correct |
5 |
Correct |
242 ms |
30304 KB |
Output is correct |
6 |
Correct |
236 ms |
30340 KB |
Output is correct |
7 |
Correct |
253 ms |
30404 KB |
Output is correct |
8 |
Correct |
237 ms |
30360 KB |
Output is correct |
9 |
Correct |
252 ms |
30408 KB |
Output is correct |
10 |
Correct |
247 ms |
30400 KB |
Output is correct |
11 |
Correct |
255 ms |
31016 KB |
Output is correct |
12 |
Correct |
248 ms |
31044 KB |
Output is correct |
13 |
Correct |
239 ms |
30860 KB |
Output is correct |
14 |
Correct |
241 ms |
31048 KB |
Output is correct |
15 |
Correct |
296 ms |
31044 KB |
Output is correct |
16 |
Correct |
227 ms |
36384 KB |
Output is correct |
17 |
Correct |
225 ms |
37788 KB |
Output is correct |
18 |
Correct |
275 ms |
35332 KB |
Output is correct |
19 |
Correct |
235 ms |
36444 KB |
Output is correct |
20 |
Correct |
229 ms |
35280 KB |
Output is correct |
21 |
Correct |
254 ms |
33384 KB |
Output is correct |
22 |
Correct |
241 ms |
43876 KB |
Output is correct |
23 |
Correct |
213 ms |
47240 KB |
Output is correct |
24 |
Correct |
255 ms |
33560 KB |
Output is correct |
25 |
Correct |
238 ms |
45936 KB |
Output is correct |
26 |
Correct |
121 ms |
58100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
123 ms |
58144 KB |
Output is correct |
2 |
Correct |
121 ms |
58180 KB |
Output is correct |
3 |
Correct |
128 ms |
58148 KB |
Output is correct |
4 |
Correct |
125 ms |
58176 KB |
Output is correct |
5 |
Correct |
120 ms |
58100 KB |
Output is correct |
6 |
Correct |
128 ms |
58080 KB |
Output is correct |
7 |
Correct |
119 ms |
58132 KB |
Output is correct |
8 |
Correct |
119 ms |
58168 KB |
Output is correct |
9 |
Correct |
123 ms |
58184 KB |
Output is correct |
10 |
Correct |
135 ms |
50584 KB |
Output is correct |
11 |
Correct |
137 ms |
50612 KB |
Output is correct |
12 |
Correct |
131 ms |
50632 KB |
Output is correct |
13 |
Correct |
132 ms |
50700 KB |
Output is correct |
14 |
Correct |
138 ms |
50632 KB |
Output is correct |
15 |
Correct |
151 ms |
42808 KB |
Output is correct |
16 |
Correct |
142 ms |
42736 KB |
Output is correct |
17 |
Correct |
146 ms |
43064 KB |
Output is correct |
18 |
Correct |
139 ms |
42812 KB |
Output is correct |
19 |
Correct |
140 ms |
42996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
7372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |