# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132476 | 2019-07-19T01:48:03 Z | sean617 | 산만한 고양이 (KOI17_cat) | C++ | 1065 ms | 22468 KB |
#include <iostream> #include <cstdio> #include <vector> #define N 300005 using namespace std; typedef long long ll; ll n, m, k, s, v[N]; bool z; vector<ll> a[N]; void f(ll p, ll q) { ll i, num; if (v[p] == k) {z = 1; return;} v[p] = k; for (i =0; i < a[p].size(); i++) { num = a[p][i]; if (num == q || num == k) continue; f(num, p); } } int main() { ll i, j, t1, t2; cin >> n >> m; while (m--) { scanf ("%lld %lld", &t1, &t2); a[t1].push_back(t2); a[t2].push_back(t1); } if (n <= 5000 && m <= 5000) { for (k = 1; k <= n; k++) { for (j = 1; j <= n; j++) { if (v[j] == k || j == k) continue; z = 0; f(j, 0); if (z) break; } if (j > n) s += k; } cout << s; return 0; } cout << 0; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 7416 KB | Output is correct |
2 | Correct | 8 ms | 7416 KB | Output is correct |
3 | Correct | 8 ms | 7416 KB | Output is correct |
4 | Correct | 8 ms | 7416 KB | Output is correct |
5 | Correct | 593 ms | 7800 KB | Output is correct |
6 | Correct | 669 ms | 7800 KB | Output is correct |
7 | Correct | 457 ms | 7800 KB | Output is correct |
8 | Correct | 669 ms | 7800 KB | Output is correct |
9 | Correct | 506 ms | 7900 KB | Output is correct |
10 | Correct | 652 ms | 7800 KB | Output is correct |
11 | Correct | 534 ms | 7800 KB | Output is correct |
12 | Correct | 518 ms | 7800 KB | Output is correct |
13 | Correct | 594 ms | 7800 KB | Output is correct |
14 | Correct | 683 ms | 7892 KB | Output is correct |
15 | Correct | 8 ms | 7416 KB | Output is correct |
16 | Correct | 8 ms | 7416 KB | Output is correct |
17 | Correct | 8 ms | 7416 KB | Output is correct |
18 | Correct | 8 ms | 7288 KB | Output is correct |
19 | Correct | 8 ms | 7416 KB | Output is correct |
20 | Correct | 413 ms | 7800 KB | Output is correct |
21 | Correct | 1065 ms | 7928 KB | Output is correct |
22 | Correct | 1008 ms | 7928 KB | Output is correct |
23 | Correct | 214 ms | 7672 KB | Output is correct |
24 | Correct | 216 ms | 7800 KB | Output is correct |
25 | Correct | 11 ms | 7544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 231 ms | 22468 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 119 ms | 20600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 7416 KB | Output is correct |
2 | Correct | 8 ms | 7416 KB | Output is correct |
3 | Correct | 8 ms | 7416 KB | Output is correct |
4 | Correct | 8 ms | 7416 KB | Output is correct |
5 | Correct | 593 ms | 7800 KB | Output is correct |
6 | Correct | 669 ms | 7800 KB | Output is correct |
7 | Correct | 457 ms | 7800 KB | Output is correct |
8 | Correct | 669 ms | 7800 KB | Output is correct |
9 | Correct | 506 ms | 7900 KB | Output is correct |
10 | Correct | 652 ms | 7800 KB | Output is correct |
11 | Correct | 534 ms | 7800 KB | Output is correct |
12 | Correct | 518 ms | 7800 KB | Output is correct |
13 | Correct | 594 ms | 7800 KB | Output is correct |
14 | Correct | 683 ms | 7892 KB | Output is correct |
15 | Correct | 8 ms | 7416 KB | Output is correct |
16 | Correct | 8 ms | 7416 KB | Output is correct |
17 | Correct | 8 ms | 7416 KB | Output is correct |
18 | Correct | 8 ms | 7288 KB | Output is correct |
19 | Correct | 8 ms | 7416 KB | Output is correct |
20 | Correct | 413 ms | 7800 KB | Output is correct |
21 | Correct | 1065 ms | 7928 KB | Output is correct |
22 | Correct | 1008 ms | 7928 KB | Output is correct |
23 | Correct | 214 ms | 7672 KB | Output is correct |
24 | Correct | 216 ms | 7800 KB | Output is correct |
25 | Correct | 11 ms | 7544 KB | Output is correct |
26 | Incorrect | 231 ms | 22468 KB | Output isn't correct |
27 | Halted | 0 ms | 0 KB | - |