# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132605 | 2019-07-19T08:25:56 Z | abra_stone | 산만한 고양이 (KOI17_cat) | C++14 | 334 ms | 35320 KB |
#include <iostream> #include <cstdio> #include <vector> #define N 300005 using namespace std; typedef long long ll; ll n, m, ans, b; vector<ll> gr[N]; bool v[N], v1[N]; ll f(ll p, ll pa) { ll i, ne, t; if (v[p]) return p; v[p] = 1; for (i = 0; i < gr[p].size(); i++) { ne = gr[p][i]; if (ne != pa) { t = f(ne, p); if (t) return t; } } return 0; } bool g(ll p, ll pa) { ll i, ne, t; if (v1[p]) return 1; v1[p] = 1; for (i = 0; i < gr[p].size(); i++) { ne = gr[p][i]; if (ne != pa && g(ne, p)) { ans += p; return 1; } } return 0; } int main() { int i, t1, t2; cin >> n >> m; for (i = 0; i < n; i++) { scanf("%d %d", &t1, &t2); gr[t1].push_back(t2); gr[t2].push_back(t1); } g(f(1, 0), 0); cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 7416 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 277 ms | 21368 KB | Output is correct |
2 | Correct | 252 ms | 23012 KB | Output is correct |
3 | Correct | 233 ms | 23132 KB | Output is correct |
4 | Correct | 225 ms | 23088 KB | Output is correct |
5 | Correct | 298 ms | 23180 KB | Output is correct |
6 | Correct | 238 ms | 23144 KB | Output is correct |
7 | Correct | 258 ms | 23064 KB | Output is correct |
8 | Correct | 250 ms | 23104 KB | Output is correct |
9 | Correct | 247 ms | 23032 KB | Output is correct |
10 | Correct | 258 ms | 23116 KB | Output is correct |
11 | Correct | 311 ms | 23488 KB | Output is correct |
12 | Correct | 274 ms | 23540 KB | Output is correct |
13 | Correct | 305 ms | 23416 KB | Output is correct |
14 | Correct | 243 ms | 23424 KB | Output is correct |
15 | Correct | 261 ms | 23344 KB | Output is correct |
16 | Correct | 276 ms | 26056 KB | Output is correct |
17 | Correct | 304 ms | 26776 KB | Output is correct |
18 | Correct | 324 ms | 26576 KB | Output is correct |
19 | Correct | 248 ms | 26100 KB | Output is correct |
20 | Correct | 317 ms | 25060 KB | Output is correct |
21 | Correct | 278 ms | 24580 KB | Output is correct |
22 | Correct | 334 ms | 29560 KB | Output is correct |
23 | Correct | 285 ms | 30840 KB | Output is correct |
24 | Correct | 237 ms | 23916 KB | Output is correct |
25 | Correct | 305 ms | 30584 KB | Output is correct |
26 | Correct | 144 ms | 35320 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 139 ms | 33624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 7416 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |