Submission #525776

# Submission time Handle Problem Language Result Execution time Memory
525776 2022-02-12T20:34:17 Z mjhmjh1104 Mountains and Valleys (CCO20_day1problem3) C++17
16 / 25
7000 ms 108840 KB
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
 
int n, m, dp[20][20971520];
vector<int> tree[200006];
vector<pair<int, int>> adj[200006];
 
int f(int x, int y) {
    if (dp[x][y] + 1) return dp[x][y];
    if (!y) return dp[x][y] = 0;
    dp[x][y] = (int)1e9;
    for (auto &i: adj[x]) dp[x][y] = min(dp[x][y], i.second + f(i.first, y & ~(1 << i.first)));
    for (auto &i: tree[x]) dp[x][y] = min(dp[x][y], 1 + f(i, y & ~(1 << i)));
    return dp[x][y];
}
 
int lt[5006][5006], par[200006], sz[200006];
bool cl[200006];
 
void dfs_lt(int x, int y, int dist = 0, int prev = -1) {
    lt[y][x] = dist;
    for (auto &i: tree[x]) if (i != prev) dfs_lt(i, y, dist + 1, x);
}
 
int dfs(int x, int prev = -1) {
    par[x] = prev;
    sz[x] = 1;
    for (auto &i: tree[x]) if (i != prev) {
        sz[x] = max(sz[x], dfs(i, x) + 1);
    }
    return sz[x];
}

int dist[200006];
 
int dfs_dist(int x, int prev = -1) {
    vector<int> v;
    int ret = 0;
    dist[x] = 0;
    for (auto &i: tree[x]) if (i != prev) {
        v.push_back(dfs_dist(i, x) + 1);
        ret = max(ret, v.back());
        dist[x] = max(dist[x], dist[i]);
    }
    sort(v.rbegin(), v.rend());
    if (!v.empty()) dist[x] = max(dist[x], v[0]);
    if ((int)v.size() > 1) dist[x] = max(dist[x], v[0] + v[1]);
    return ret;
}
 
int main() {
    scanf("%d%d", &n, &m);
    while (m--) {
        int x, y, w;
        scanf("%d%d%d", &x, &y, &w);
        if (w == 1) {
            tree[x].push_back(y);
            tree[y].push_back(x);
        } else {
            adj[x].push_back({ y, w });
            adj[y].push_back({ x, w });
        }
    }
    if (n <= 20) {
        for (int i = 0; i < n; i++) for (int j = 0; j < 1 << n; j++) dp[i][j] = -1;
        int res = (int)1e9;
        for (int i = 0; i < n; i++) res = min(res, f(i, (1 << n) - 1 ^ 1 << i));
        printf("%d", res);
        return 0;
    }
    for (int i = 0; i < n; i++) dfs_lt(i, i);
    dfs_dist(0);
    int zero = 2 * (n - 1) - dist[0], one = (int)1e9;
    if (n <= 5000) for (int i = 0; i < n; i++) for (auto &j: adj[i]) if (i < j.first) {
        int curr = j.second + 2 * (n - 1) - lt[i][j.first] - 1;
        dfs(i);
        int x = j.first, pv = -1;
        vector<pair<int, int>> v;
        int y = -1, T = 0;
        dfs_dist(i);
        while (x != -1) {
            v.push_back({ 0, T++ });
            vector<int> curr;
            for (auto &k: tree[x]) if (k != pv && k != par[x]) {
                v.back().first = max(v.back().first, sz[k]);
                y = max(y, dist[k] - 1);
                curr.push_back(sz[k]);
            }
            sort(curr.rbegin(), curr.rend());
            if (!curr.empty()) y = max(y, curr[0]);
            if ((int)curr.size() > 1) y = max(y, curr[0] + curr[1] - 1);
            pv = x;
            x = par[x];
            if (!v.back().first) v.pop_back();
        }
        for (int i = 0; i < (int)v.size(); i++) for (int j = i + 1; j < (int)v.size(); j++) y = max(y, v[i].first + v[j].first - (v[j].second - v[i].second - 1));
        curr -= y;
        one = min(one, curr);
    }
    printf("%d", min(zero, one));
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:70:66: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   70 |         for (int i = 0; i < n; i++) res = min(res, f(i, (1 << n) - 1 ^ 1 << i));
      |                                                         ~~~~~~~~~^~~
Main.cpp:55:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:58:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         scanf("%d%d%d", &x, &y, &w);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3142 ms 108664 KB Output is correct
2 Correct 3053 ms 108612 KB Output is correct
3 Correct 2980 ms 108508 KB Output is correct
4 Correct 2799 ms 108212 KB Output is correct
5 Correct 2793 ms 108288 KB Output is correct
6 Correct 1107 ms 108220 KB Output is correct
7 Correct 2992 ms 108576 KB Output is correct
8 Correct 6161 ms 108476 KB Output is correct
9 Correct 3719 ms 108592 KB Output is correct
10 Correct 2831 ms 108424 KB Output is correct
11 Correct 2831 ms 108484 KB Output is correct
12 Correct 2693 ms 108116 KB Output is correct
13 Correct 2841 ms 108416 KB Output is correct
14 Correct 2868 ms 108336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
36 Correct 6 ms 10060 KB Output is correct
37 Correct 6 ms 10060 KB Output is correct
38 Correct 6 ms 10124 KB Output is correct
39 Correct 6 ms 10060 KB Output is correct
40 Correct 6 ms 10052 KB Output is correct
41 Correct 6 ms 10060 KB Output is correct
42 Correct 6 ms 10060 KB Output is correct
43 Correct 6 ms 10132 KB Output is correct
44 Correct 6 ms 10060 KB Output is correct
45 Correct 7 ms 10108 KB Output is correct
46 Correct 6 ms 10128 KB Output is correct
47 Correct 5 ms 10060 KB Output is correct
48 Correct 5 ms 10060 KB Output is correct
49 Correct 6 ms 10060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
36 Correct 6 ms 10060 KB Output is correct
37 Correct 6 ms 10060 KB Output is correct
38 Correct 6 ms 10124 KB Output is correct
39 Correct 6 ms 10060 KB Output is correct
40 Correct 6 ms 10052 KB Output is correct
41 Correct 6 ms 10060 KB Output is correct
42 Correct 6 ms 10060 KB Output is correct
43 Correct 6 ms 10132 KB Output is correct
44 Correct 6 ms 10060 KB Output is correct
45 Correct 7 ms 10108 KB Output is correct
46 Correct 6 ms 10128 KB Output is correct
47 Correct 5 ms 10060 KB Output is correct
48 Correct 5 ms 10060 KB Output is correct
49 Correct 6 ms 10060 KB Output is correct
50 Correct 27 ms 12684 KB Output is correct
51 Correct 29 ms 12792 KB Output is correct
52 Correct 30 ms 12756 KB Output is correct
53 Correct 27 ms 12652 KB Output is correct
54 Correct 26 ms 12620 KB Output is correct
55 Correct 16 ms 12620 KB Output is correct
56 Correct 28 ms 12772 KB Output is correct
57 Correct 34 ms 12684 KB Output is correct
58 Correct 31 ms 12772 KB Output is correct
59 Correct 28 ms 12748 KB Output is correct
60 Correct 27 ms 12620 KB Output is correct
61 Correct 29 ms 12620 KB Output is correct
62 Correct 13 ms 12620 KB Output is correct
63 Correct 13 ms 12740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
36 Correct 3142 ms 108664 KB Output is correct
37 Correct 3053 ms 108612 KB Output is correct
38 Correct 2980 ms 108508 KB Output is correct
39 Correct 2799 ms 108212 KB Output is correct
40 Correct 2793 ms 108288 KB Output is correct
41 Correct 1107 ms 108220 KB Output is correct
42 Correct 2992 ms 108576 KB Output is correct
43 Correct 6161 ms 108476 KB Output is correct
44 Correct 3719 ms 108592 KB Output is correct
45 Correct 2831 ms 108424 KB Output is correct
46 Correct 2831 ms 108484 KB Output is correct
47 Correct 2693 ms 108116 KB Output is correct
48 Correct 2841 ms 108416 KB Output is correct
49 Correct 2868 ms 108336 KB Output is correct
50 Correct 6 ms 10060 KB Output is correct
51 Correct 6 ms 10060 KB Output is correct
52 Correct 6 ms 10124 KB Output is correct
53 Correct 6 ms 10060 KB Output is correct
54 Correct 6 ms 10052 KB Output is correct
55 Correct 6 ms 10060 KB Output is correct
56 Correct 6 ms 10060 KB Output is correct
57 Correct 6 ms 10132 KB Output is correct
58 Correct 6 ms 10060 KB Output is correct
59 Correct 7 ms 10108 KB Output is correct
60 Correct 6 ms 10128 KB Output is correct
61 Correct 5 ms 10060 KB Output is correct
62 Correct 5 ms 10060 KB Output is correct
63 Correct 6 ms 10060 KB Output is correct
64 Correct 27 ms 12684 KB Output is correct
65 Correct 29 ms 12792 KB Output is correct
66 Correct 30 ms 12756 KB Output is correct
67 Correct 27 ms 12652 KB Output is correct
68 Correct 26 ms 12620 KB Output is correct
69 Correct 16 ms 12620 KB Output is correct
70 Correct 28 ms 12772 KB Output is correct
71 Correct 34 ms 12684 KB Output is correct
72 Correct 31 ms 12772 KB Output is correct
73 Correct 28 ms 12748 KB Output is correct
74 Correct 27 ms 12620 KB Output is correct
75 Correct 29 ms 12620 KB Output is correct
76 Correct 13 ms 12620 KB Output is correct
77 Correct 13 ms 12740 KB Output is correct
78 Correct 3070 ms 108840 KB Output is correct
79 Correct 3095 ms 108676 KB Output is correct
80 Correct 3028 ms 108396 KB Output is correct
81 Correct 2899 ms 108320 KB Output is correct
82 Correct 2819 ms 108244 KB Output is correct
83 Correct 1081 ms 108116 KB Output is correct
84 Correct 2998 ms 108692 KB Output is correct
85 Correct 5008 ms 108448 KB Output is correct
86 Correct 3432 ms 108612 KB Output is correct
87 Correct 2815 ms 108280 KB Output is correct
88 Correct 2921 ms 108316 KB Output is correct
89 Correct 2760 ms 108132 KB Output is correct
90 Correct 1010 ms 108200 KB Output is correct
91 Correct 1020 ms 108308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
36 Correct 3142 ms 108664 KB Output is correct
37 Correct 3053 ms 108612 KB Output is correct
38 Correct 2980 ms 108508 KB Output is correct
39 Correct 2799 ms 108212 KB Output is correct
40 Correct 2793 ms 108288 KB Output is correct
41 Correct 1107 ms 108220 KB Output is correct
42 Correct 2992 ms 108576 KB Output is correct
43 Correct 6161 ms 108476 KB Output is correct
44 Correct 3719 ms 108592 KB Output is correct
45 Correct 2831 ms 108424 KB Output is correct
46 Correct 2831 ms 108484 KB Output is correct
47 Correct 2693 ms 108116 KB Output is correct
48 Correct 2841 ms 108416 KB Output is correct
49 Correct 2868 ms 108336 KB Output is correct
50 Correct 6 ms 10060 KB Output is correct
51 Correct 6 ms 10060 KB Output is correct
52 Correct 6 ms 10124 KB Output is correct
53 Correct 6 ms 10060 KB Output is correct
54 Correct 6 ms 10052 KB Output is correct
55 Correct 6 ms 10060 KB Output is correct
56 Correct 6 ms 10060 KB Output is correct
57 Correct 6 ms 10132 KB Output is correct
58 Correct 6 ms 10060 KB Output is correct
59 Correct 7 ms 10108 KB Output is correct
60 Correct 6 ms 10128 KB Output is correct
61 Correct 5 ms 10060 KB Output is correct
62 Correct 5 ms 10060 KB Output is correct
63 Correct 6 ms 10060 KB Output is correct
64 Correct 27 ms 12684 KB Output is correct
65 Correct 29 ms 12792 KB Output is correct
66 Correct 30 ms 12756 KB Output is correct
67 Correct 27 ms 12652 KB Output is correct
68 Correct 26 ms 12620 KB Output is correct
69 Correct 16 ms 12620 KB Output is correct
70 Correct 28 ms 12772 KB Output is correct
71 Correct 34 ms 12684 KB Output is correct
72 Correct 31 ms 12772 KB Output is correct
73 Correct 28 ms 12748 KB Output is correct
74 Correct 27 ms 12620 KB Output is correct
75 Correct 29 ms 12620 KB Output is correct
76 Correct 13 ms 12620 KB Output is correct
77 Correct 13 ms 12740 KB Output is correct
78 Correct 3070 ms 108840 KB Output is correct
79 Correct 3095 ms 108676 KB Output is correct
80 Correct 3028 ms 108396 KB Output is correct
81 Correct 2899 ms 108320 KB Output is correct
82 Correct 2819 ms 108244 KB Output is correct
83 Correct 1081 ms 108116 KB Output is correct
84 Correct 2998 ms 108692 KB Output is correct
85 Correct 5008 ms 108448 KB Output is correct
86 Correct 3432 ms 108612 KB Output is correct
87 Correct 2815 ms 108280 KB Output is correct
88 Correct 2921 ms 108316 KB Output is correct
89 Correct 2760 ms 108132 KB Output is correct
90 Correct 1010 ms 108200 KB Output is correct
91 Correct 1020 ms 108308 KB Output is correct
92 Execution timed out 7059 ms 42536 KB Time limit exceeded
93 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9676 KB Output is correct
2 Correct 5 ms 9676 KB Output is correct
3 Correct 6 ms 9676 KB Output is correct
4 Correct 7 ms 9664 KB Output is correct
5 Correct 5 ms 9608 KB Output is correct
6 Correct 5 ms 9676 KB Output is correct
7 Correct 5 ms 9728 KB Output is correct
8 Correct 5 ms 9676 KB Output is correct
9 Correct 7 ms 9676 KB Output is correct
10 Correct 5 ms 9644 KB Output is correct
11 Correct 5 ms 9676 KB Output is correct
12 Correct 5 ms 9676 KB Output is correct
13 Correct 4 ms 9676 KB Output is correct
14 Correct 4 ms 9676 KB Output is correct
15 Correct 5 ms 9676 KB Output is correct
16 Correct 6 ms 9676 KB Output is correct
17 Correct 4 ms 9676 KB Output is correct
18 Correct 5 ms 9676 KB Output is correct
19 Correct 5 ms 9932 KB Output is correct
20 Correct 6 ms 11724 KB Output is correct
21 Correct 6 ms 11724 KB Output is correct
22 Correct 172 ms 91924 KB Output is correct
23 Correct 46 ms 48820 KB Output is correct
24 Correct 40 ms 48716 KB Output is correct
25 Correct 33 ms 28236 KB Output is correct
26 Correct 56 ms 28244 KB Output is correct
27 Correct 282 ms 91976 KB Output is correct
28 Correct 20 ms 28260 KB Output is correct
29 Correct 31 ms 28264 KB Output is correct
30 Correct 23 ms 28236 KB Output is correct
31 Correct 32 ms 28260 KB Output is correct
32 Correct 10 ms 11728 KB Output is correct
33 Correct 6 ms 9676 KB Output is correct
34 Correct 15 ms 28172 KB Output is correct
35 Correct 14 ms 28236 KB Output is correct
36 Correct 3142 ms 108664 KB Output is correct
37 Correct 3053 ms 108612 KB Output is correct
38 Correct 2980 ms 108508 KB Output is correct
39 Correct 2799 ms 108212 KB Output is correct
40 Correct 2793 ms 108288 KB Output is correct
41 Correct 1107 ms 108220 KB Output is correct
42 Correct 2992 ms 108576 KB Output is correct
43 Correct 6161 ms 108476 KB Output is correct
44 Correct 3719 ms 108592 KB Output is correct
45 Correct 2831 ms 108424 KB Output is correct
46 Correct 2831 ms 108484 KB Output is correct
47 Correct 2693 ms 108116 KB Output is correct
48 Correct 2841 ms 108416 KB Output is correct
49 Correct 2868 ms 108336 KB Output is correct
50 Correct 6 ms 10060 KB Output is correct
51 Correct 6 ms 10060 KB Output is correct
52 Correct 6 ms 10124 KB Output is correct
53 Correct 6 ms 10060 KB Output is correct
54 Correct 6 ms 10052 KB Output is correct
55 Correct 6 ms 10060 KB Output is correct
56 Correct 6 ms 10060 KB Output is correct
57 Correct 6 ms 10132 KB Output is correct
58 Correct 6 ms 10060 KB Output is correct
59 Correct 7 ms 10108 KB Output is correct
60 Correct 6 ms 10128 KB Output is correct
61 Correct 5 ms 10060 KB Output is correct
62 Correct 5 ms 10060 KB Output is correct
63 Correct 6 ms 10060 KB Output is correct
64 Correct 27 ms 12684 KB Output is correct
65 Correct 29 ms 12792 KB Output is correct
66 Correct 30 ms 12756 KB Output is correct
67 Correct 27 ms 12652 KB Output is correct
68 Correct 26 ms 12620 KB Output is correct
69 Correct 16 ms 12620 KB Output is correct
70 Correct 28 ms 12772 KB Output is correct
71 Correct 34 ms 12684 KB Output is correct
72 Correct 31 ms 12772 KB Output is correct
73 Correct 28 ms 12748 KB Output is correct
74 Correct 27 ms 12620 KB Output is correct
75 Correct 29 ms 12620 KB Output is correct
76 Correct 13 ms 12620 KB Output is correct
77 Correct 13 ms 12740 KB Output is correct
78 Correct 3070 ms 108840 KB Output is correct
79 Correct 3095 ms 108676 KB Output is correct
80 Correct 3028 ms 108396 KB Output is correct
81 Correct 2899 ms 108320 KB Output is correct
82 Correct 2819 ms 108244 KB Output is correct
83 Correct 1081 ms 108116 KB Output is correct
84 Correct 2998 ms 108692 KB Output is correct
85 Correct 5008 ms 108448 KB Output is correct
86 Correct 3432 ms 108612 KB Output is correct
87 Correct 2815 ms 108280 KB Output is correct
88 Correct 2921 ms 108316 KB Output is correct
89 Correct 2760 ms 108132 KB Output is correct
90 Correct 1010 ms 108200 KB Output is correct
91 Correct 1020 ms 108308 KB Output is correct
92 Execution timed out 7059 ms 42536 KB Time limit exceeded
93 Halted 0 ms 0 KB -