Submission #430561

# Submission time Handle Problem Language Result Execution time Memory
430561 2021-06-16T15:56:23 Z keko37 From Hacks to Snitches (BOI21_watchmen) C++14
100 / 100
3001 ms 173708 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long llint;
typedef pair <int, int> pi;

const int MAXN = 250005;
const llint INF = 1000000000000000000LL;

int n, m, k;
int d[MAXN], ost[MAXN], koji[MAXN], prv[MAXN], nxt[MAXN];
llint best[MAXN], dist[3005][3005];
vector <pi> edges;

bool watched[MAXN];
vector <int> good, bad, sus_good[MAXN], sus_bad[MAXN];

void build () {
    for (int i = 1; i <= n; i++) {
        if (watched[i]) bad.push_back(i); else good.push_back(i);
    }
    for (int i = 0; i < bad.size(); i++) {
        koji[bad[i]] = i;
    }
    for (auto pp : edges) {
        int a = pp.first, b = pp.second;
        if (watched[b]) sus_bad[a].push_back(b); else sus_good[a].push_back(b);
        if (watched[a]) sus_bad[b].push_back(a); else sus_good[b].push_back(a);
    }
}

priority_queue < pair <llint, pi> > pq;

void dijkstra () {
    for (int i = 1; i <= n; i++) {
        best[i] = INF;
    }
    for (int i = 0; i < bad.size(); i++) {
        int node = bad[i];
        for (int j = 0; j < d[node]; j++) {
            dist[i][j] = INF;
        }
    }
    best[1] = 0;
    pq.push({0, {-1, 1}});

    while (!pq.empty()) {
        llint pq_dist = -pq.top().first;
        int jen = pq.top().second.first;
        int dva = pq.top().second.second;
        pq.pop();
        int node;
        if (jen == -1) {
            node = dva;
            if (pq_dist > best[node]) continue;
        } else {
            node = bad[jen];
            if (pq_dist > dist[jen][dva]) continue;
        }
        if (!watched[node]) {
            for (auto sus : sus_good[node]) {
                llint novi = best[node] + 1;
                if (novi < best[sus]) {
                    best[sus] = novi;
                    pq.push({-novi, {-1, sus}});
                }
            }
            for (auto sus : sus_bad[node]) {
                llint novi = best[node] + 1;
                llint T = ((ost[sus] - novi) % d[sus] + d[sus]) % d[sus] + novi;
                int curr_ost = novi % d[sus];
                if (novi < dist[koji[sus]][curr_ost] && novi < T) {
                    dist[koji[sus]][curr_ost] = novi;
                    pq.push({-novi, {koji[sus], curr_ost}});
                }
                curr_ost = (T + 1) % d[sus];
                if (T + 1 < dist[koji[sus]][curr_ost]) {
                    dist[koji[sus]][curr_ost] = T + 1;
                    pq.push({-(T + 1), {koji[sus], curr_ost}});
                }
            }
        } else {
            if (best[node] == INF) {
                best[node] = pq_dist;
                for (auto sus : sus_good[node]) {
                    llint novi = best[node] + 1;
                    if (novi < best[sus]) {
                        best[sus] = novi;
                        pq.push({-novi, {-1, sus}});
                    }
                }
            }
            vector <int> sus_tmp;
            for (auto sus : sus_bad[node]) {
                if (sus == prv[node] || sus == nxt[node]) continue;
                llint novi = pq_dist + 1;
                llint T = ((ost[sus] - novi) % d[sus] + d[sus]) % d[sus] + novi;
                int curr_ost = novi % d[sus];
                if (novi < dist[koji[sus]][curr_ost] && novi < T) {
                    dist[koji[sus]][curr_ost] = novi;
                    pq.push({-novi, {koji[sus], curr_ost}});
                }

                if (T % d[node] != ost[node]) {
                    curr_ost = (T + 1) % d[sus];
                    if (T + 1 < dist[koji[sus]][curr_ost]) {
                        dist[koji[sus]][curr_ost] = T + 1;
                        pq.push({-(T + 1), {koji[sus], curr_ost}});
                    }
                } else {
                    sus_tmp.push_back(sus);
                    int t = ((pq_dist % d[node] - (T + 1)) % d[node] + d[node]) % d[node] + (T + 1);
                    int T2 = ((ost[sus] - (t + 1)) % d[sus] + d[sus]) % d[sus] + (t + 1);

                    curr_ost = (t + 1) % d[sus];
                    if (t + 1 < dist[koji[sus]][curr_ost] && t + 1 < T2) {
                        dist[koji[sus]][curr_ost] = t + 1;
                        pq.push({-(t + 1), {koji[sus], curr_ost}});
                    }
                    curr_ost = (T2 + 1) % d[sus];
                    if (T2 + 1 < dist[koji[sus]][curr_ost] && T2 % d[node] != ost[node]) {
                        dist[koji[sus]][curr_ost] = T2 + 1;
                        pq.push({-(T2 + 1), {koji[sus], curr_ost}});
                    }
                }
            }
            sus_bad[node] = sus_tmp;

            int sus = prv[node];
            llint novi = pq_dist + 1;
            int curr_ost = novi % d[node];
            if (curr_ost != ost[node] && curr_ost != ost[sus] && novi < dist[koji[sus]][curr_ost]) {
                dist[koji[sus]][curr_ost] = novi;
                pq.push({-novi, {koji[sus], curr_ost}});
            }
            sus = nxt[node];
            if (curr_ost != ost[sus] && novi < dist[koji[sus]][curr_ost]) {
                dist[koji[sus]][curr_ost] = novi;
                pq.push({-novi, {koji[sus], curr_ost}});
            }
            sus = node;
            if (curr_ost != ost[sus] && novi < dist[koji[sus]][curr_ost]) {
                dist[koji[sus]][curr_ost] = novi;
                pq.push({-novi, {koji[sus], curr_ost}});
            }
        }
    }
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        edges.push_back({a, b});
    }
    cin >> k;
    for (int i = 1; i <= k; i++) {
        int len;
        cin >> len;
        vector <int> tmp;
        for (int j = 0; j < len; j++) {
            int node;
            cin >> node;
            tmp.push_back(node);
            watched[node] = 1;
            d[node] = len;
            ost[node] = j;
        }
        for (int i = 0; i < len; i++) {
            prv[tmp[i]] = tmp[(i - 1 + len) % len];
            nxt[tmp[i]] = tmp[(i + 1) % len];
        }
    }
    build();
    dijkstra();
    if (best[n] == INF) cout << "impossible"; else cout << best[n];
    return 0;
}

Compilation message

watchmen.cpp: In function 'void build()':
watchmen.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < bad.size(); i++) {
      |                     ~~^~~~~~~~~~~~
watchmen.cpp: In function 'void dijkstra()':
watchmen.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < bad.size(); i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 34 ms 15120 KB Output is correct
2 Correct 90 ms 20296 KB Output is correct
3 Correct 92 ms 20184 KB Output is correct
4 Correct 91 ms 20288 KB Output is correct
5 Correct 12 ms 12620 KB Output is correct
6 Correct 105 ms 20072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 15132 KB Output is correct
2 Correct 84 ms 20392 KB Output is correct
3 Correct 82 ms 20168 KB Output is correct
4 Correct 92 ms 20324 KB Output is correct
5 Correct 13 ms 12620 KB Output is correct
6 Correct 89 ms 20116 KB Output is correct
7 Correct 75 ms 20008 KB Output is correct
8 Correct 88 ms 20048 KB Output is correct
9 Correct 97 ms 20028 KB Output is correct
10 Correct 114 ms 20508 KB Output is correct
11 Correct 102 ms 20252 KB Output is correct
12 Correct 92 ms 20012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 15132 KB Output is correct
2 Correct 84 ms 20392 KB Output is correct
3 Correct 82 ms 20168 KB Output is correct
4 Correct 92 ms 20324 KB Output is correct
5 Correct 13 ms 12620 KB Output is correct
6 Correct 89 ms 20116 KB Output is correct
7 Correct 75 ms 20008 KB Output is correct
8 Correct 88 ms 20048 KB Output is correct
9 Correct 97 ms 20028 KB Output is correct
10 Correct 114 ms 20508 KB Output is correct
11 Correct 102 ms 20252 KB Output is correct
12 Correct 92 ms 20012 KB Output is correct
13 Correct 31 ms 15040 KB Output is correct
14 Correct 100 ms 20284 KB Output is correct
15 Correct 77 ms 20112 KB Output is correct
16 Correct 86 ms 20284 KB Output is correct
17 Correct 11 ms 12712 KB Output is correct
18 Correct 96 ms 20164 KB Output is correct
19 Correct 84 ms 19992 KB Output is correct
20 Correct 76 ms 20028 KB Output is correct
21 Correct 98 ms 20100 KB Output is correct
22 Correct 85 ms 20452 KB Output is correct
23 Correct 84 ms 20336 KB Output is correct
24 Correct 75 ms 20028 KB Output is correct
25 Correct 1769 ms 126048 KB Output is correct
26 Correct 1625 ms 133528 KB Output is correct
27 Correct 1515 ms 126380 KB Output is correct
28 Correct 1283 ms 130356 KB Output is correct
29 Correct 1754 ms 124212 KB Output is correct
30 Correct 1714 ms 126492 KB Output is correct
31 Correct 1810 ms 134696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 15132 KB Output is correct
2 Correct 84 ms 20392 KB Output is correct
3 Correct 82 ms 20168 KB Output is correct
4 Correct 92 ms 20324 KB Output is correct
5 Correct 13 ms 12620 KB Output is correct
6 Correct 89 ms 20116 KB Output is correct
7 Correct 75 ms 20008 KB Output is correct
8 Correct 88 ms 20048 KB Output is correct
9 Correct 97 ms 20028 KB Output is correct
10 Correct 114 ms 20508 KB Output is correct
11 Correct 102 ms 20252 KB Output is correct
12 Correct 92 ms 20012 KB Output is correct
13 Correct 31 ms 15040 KB Output is correct
14 Correct 100 ms 20284 KB Output is correct
15 Correct 77 ms 20112 KB Output is correct
16 Correct 86 ms 20284 KB Output is correct
17 Correct 11 ms 12712 KB Output is correct
18 Correct 96 ms 20164 KB Output is correct
19 Correct 84 ms 19992 KB Output is correct
20 Correct 76 ms 20028 KB Output is correct
21 Correct 98 ms 20100 KB Output is correct
22 Correct 85 ms 20452 KB Output is correct
23 Correct 84 ms 20336 KB Output is correct
24 Correct 75 ms 20028 KB Output is correct
25 Correct 1769 ms 126048 KB Output is correct
26 Correct 1625 ms 133528 KB Output is correct
27 Correct 1515 ms 126380 KB Output is correct
28 Correct 1283 ms 130356 KB Output is correct
29 Correct 1754 ms 124212 KB Output is correct
30 Correct 1714 ms 126492 KB Output is correct
31 Correct 1810 ms 134696 KB Output is correct
32 Correct 35 ms 15008 KB Output is correct
33 Correct 92 ms 20288 KB Output is correct
34 Correct 86 ms 20136 KB Output is correct
35 Correct 93 ms 20268 KB Output is correct
36 Correct 11 ms 12620 KB Output is correct
37 Correct 87 ms 20048 KB Output is correct
38 Correct 90 ms 19960 KB Output is correct
39 Correct 73 ms 20032 KB Output is correct
40 Correct 82 ms 20000 KB Output is correct
41 Correct 86 ms 20528 KB Output is correct
42 Correct 100 ms 20284 KB Output is correct
43 Correct 79 ms 20028 KB Output is correct
44 Correct 1668 ms 125980 KB Output is correct
45 Correct 1645 ms 133492 KB Output is correct
46 Correct 1536 ms 126316 KB Output is correct
47 Correct 1298 ms 130188 KB Output is correct
48 Correct 1698 ms 124232 KB Output is correct
49 Correct 1722 ms 126568 KB Output is correct
50 Correct 1793 ms 134824 KB Output is correct
51 Correct 2239 ms 150532 KB Output is correct
52 Correct 2493 ms 173708 KB Output is correct
53 Correct 2077 ms 155988 KB Output is correct
54 Correct 1201 ms 131432 KB Output is correct
55 Correct 2279 ms 154944 KB Output is correct
56 Correct 2218 ms 145484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 15120 KB Output is correct
2 Correct 90 ms 20296 KB Output is correct
3 Correct 92 ms 20184 KB Output is correct
4 Correct 91 ms 20288 KB Output is correct
5 Correct 12 ms 12620 KB Output is correct
6 Correct 105 ms 20072 KB Output is correct
7 Correct 35 ms 15132 KB Output is correct
8 Correct 84 ms 20392 KB Output is correct
9 Correct 82 ms 20168 KB Output is correct
10 Correct 92 ms 20324 KB Output is correct
11 Correct 13 ms 12620 KB Output is correct
12 Correct 89 ms 20116 KB Output is correct
13 Correct 75 ms 20008 KB Output is correct
14 Correct 88 ms 20048 KB Output is correct
15 Correct 97 ms 20028 KB Output is correct
16 Correct 114 ms 20508 KB Output is correct
17 Correct 102 ms 20252 KB Output is correct
18 Correct 92 ms 20012 KB Output is correct
19 Correct 9 ms 12020 KB Output is correct
20 Correct 8 ms 12108 KB Output is correct
21 Correct 10 ms 12108 KB Output is correct
22 Correct 35 ms 15048 KB Output is correct
23 Correct 76 ms 20412 KB Output is correct
24 Correct 71 ms 20196 KB Output is correct
25 Correct 79 ms 20380 KB Output is correct
26 Correct 10 ms 12620 KB Output is correct
27 Correct 106 ms 20040 KB Output is correct
28 Correct 76 ms 20032 KB Output is correct
29 Correct 70 ms 19972 KB Output is correct
30 Correct 69 ms 20024 KB Output is correct
31 Correct 87 ms 20540 KB Output is correct
32 Correct 76 ms 20264 KB Output is correct
33 Correct 72 ms 20100 KB Output is correct
34 Correct 1698 ms 127864 KB Output is correct
35 Correct 1657 ms 123024 KB Output is correct
36 Correct 1668 ms 122900 KB Output is correct
37 Correct 1499 ms 128160 KB Output is correct
38 Correct 1560 ms 124596 KB Output is correct
39 Correct 1559 ms 124052 KB Output is correct
40 Correct 1635 ms 124328 KB Output is correct
41 Correct 1761 ms 123852 KB Output is correct
42 Correct 1639 ms 124716 KB Output is correct
43 Correct 1650 ms 131448 KB Output is correct
44 Correct 1713 ms 131672 KB Output is correct
45 Correct 1854 ms 125276 KB Output is correct
46 Correct 1662 ms 124544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 15120 KB Output is correct
2 Correct 90 ms 20296 KB Output is correct
3 Correct 92 ms 20184 KB Output is correct
4 Correct 91 ms 20288 KB Output is correct
5 Correct 12 ms 12620 KB Output is correct
6 Correct 105 ms 20072 KB Output is correct
7 Correct 35 ms 15132 KB Output is correct
8 Correct 84 ms 20392 KB Output is correct
9 Correct 82 ms 20168 KB Output is correct
10 Correct 92 ms 20324 KB Output is correct
11 Correct 13 ms 12620 KB Output is correct
12 Correct 89 ms 20116 KB Output is correct
13 Correct 75 ms 20008 KB Output is correct
14 Correct 88 ms 20048 KB Output is correct
15 Correct 97 ms 20028 KB Output is correct
16 Correct 114 ms 20508 KB Output is correct
17 Correct 102 ms 20252 KB Output is correct
18 Correct 92 ms 20012 KB Output is correct
19 Correct 31 ms 15040 KB Output is correct
20 Correct 100 ms 20284 KB Output is correct
21 Correct 77 ms 20112 KB Output is correct
22 Correct 86 ms 20284 KB Output is correct
23 Correct 11 ms 12712 KB Output is correct
24 Correct 96 ms 20164 KB Output is correct
25 Correct 84 ms 19992 KB Output is correct
26 Correct 76 ms 20028 KB Output is correct
27 Correct 98 ms 20100 KB Output is correct
28 Correct 85 ms 20452 KB Output is correct
29 Correct 84 ms 20336 KB Output is correct
30 Correct 75 ms 20028 KB Output is correct
31 Correct 1769 ms 126048 KB Output is correct
32 Correct 1625 ms 133528 KB Output is correct
33 Correct 1515 ms 126380 KB Output is correct
34 Correct 1283 ms 130356 KB Output is correct
35 Correct 1754 ms 124212 KB Output is correct
36 Correct 1714 ms 126492 KB Output is correct
37 Correct 1810 ms 134696 KB Output is correct
38 Correct 9 ms 12020 KB Output is correct
39 Correct 8 ms 12108 KB Output is correct
40 Correct 10 ms 12108 KB Output is correct
41 Correct 35 ms 15048 KB Output is correct
42 Correct 76 ms 20412 KB Output is correct
43 Correct 71 ms 20196 KB Output is correct
44 Correct 79 ms 20380 KB Output is correct
45 Correct 10 ms 12620 KB Output is correct
46 Correct 106 ms 20040 KB Output is correct
47 Correct 76 ms 20032 KB Output is correct
48 Correct 70 ms 19972 KB Output is correct
49 Correct 69 ms 20024 KB Output is correct
50 Correct 87 ms 20540 KB Output is correct
51 Correct 76 ms 20264 KB Output is correct
52 Correct 72 ms 20100 KB Output is correct
53 Correct 1698 ms 127864 KB Output is correct
54 Correct 1657 ms 123024 KB Output is correct
55 Correct 1668 ms 122900 KB Output is correct
56 Correct 1499 ms 128160 KB Output is correct
57 Correct 1560 ms 124596 KB Output is correct
58 Correct 1559 ms 124052 KB Output is correct
59 Correct 1635 ms 124328 KB Output is correct
60 Correct 1761 ms 123852 KB Output is correct
61 Correct 1639 ms 124716 KB Output is correct
62 Correct 1650 ms 131448 KB Output is correct
63 Correct 1713 ms 131672 KB Output is correct
64 Correct 1854 ms 125276 KB Output is correct
65 Correct 1662 ms 124544 KB Output is correct
66 Correct 9 ms 12108 KB Output is correct
67 Correct 9 ms 12108 KB Output is correct
68 Correct 12 ms 12108 KB Output is correct
69 Correct 31 ms 15116 KB Output is correct
70 Correct 117 ms 20288 KB Output is correct
71 Correct 89 ms 20128 KB Output is correct
72 Correct 82 ms 20328 KB Output is correct
73 Correct 13 ms 12620 KB Output is correct
74 Correct 86 ms 20152 KB Output is correct
75 Correct 86 ms 20004 KB Output is correct
76 Correct 73 ms 20036 KB Output is correct
77 Correct 77 ms 20052 KB Output is correct
78 Correct 82 ms 20524 KB Output is correct
79 Correct 88 ms 20312 KB Output is correct
80 Correct 80 ms 19984 KB Output is correct
81 Correct 1756 ms 125892 KB Output is correct
82 Correct 1675 ms 133440 KB Output is correct
83 Correct 1518 ms 126440 KB Output is correct
84 Correct 1375 ms 130276 KB Output is correct
85 Correct 1775 ms 124260 KB Output is correct
86 Correct 1751 ms 126440 KB Output is correct
87 Correct 1871 ms 134732 KB Output is correct
88 Correct 1874 ms 127816 KB Output is correct
89 Correct 1797 ms 122996 KB Output is correct
90 Correct 1746 ms 122944 KB Output is correct
91 Correct 1587 ms 128192 KB Output is correct
92 Correct 1723 ms 124548 KB Output is correct
93 Correct 1722 ms 123964 KB Output is correct
94 Correct 1698 ms 124152 KB Output is correct
95 Correct 1748 ms 123868 KB Output is correct
96 Correct 1604 ms 124652 KB Output is correct
97 Correct 1700 ms 131300 KB Output is correct
98 Correct 1736 ms 131764 KB Output is correct
99 Correct 1903 ms 125232 KB Output is correct
100 Correct 1602 ms 124492 KB Output is correct
101 Correct 1759 ms 130364 KB Output is correct
102 Correct 1671 ms 130560 KB Output is correct
103 Correct 1702 ms 127076 KB Output is correct
104 Correct 1758 ms 129236 KB Output is correct
105 Correct 1666 ms 126908 KB Output is correct
106 Correct 1980 ms 127864 KB Output is correct
107 Correct 1888 ms 127468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 15120 KB Output is correct
2 Correct 90 ms 20296 KB Output is correct
3 Correct 92 ms 20184 KB Output is correct
4 Correct 91 ms 20288 KB Output is correct
5 Correct 12 ms 12620 KB Output is correct
6 Correct 105 ms 20072 KB Output is correct
7 Correct 35 ms 15132 KB Output is correct
8 Correct 84 ms 20392 KB Output is correct
9 Correct 82 ms 20168 KB Output is correct
10 Correct 92 ms 20324 KB Output is correct
11 Correct 13 ms 12620 KB Output is correct
12 Correct 89 ms 20116 KB Output is correct
13 Correct 75 ms 20008 KB Output is correct
14 Correct 88 ms 20048 KB Output is correct
15 Correct 97 ms 20028 KB Output is correct
16 Correct 114 ms 20508 KB Output is correct
17 Correct 102 ms 20252 KB Output is correct
18 Correct 92 ms 20012 KB Output is correct
19 Correct 31 ms 15040 KB Output is correct
20 Correct 100 ms 20284 KB Output is correct
21 Correct 77 ms 20112 KB Output is correct
22 Correct 86 ms 20284 KB Output is correct
23 Correct 11 ms 12712 KB Output is correct
24 Correct 96 ms 20164 KB Output is correct
25 Correct 84 ms 19992 KB Output is correct
26 Correct 76 ms 20028 KB Output is correct
27 Correct 98 ms 20100 KB Output is correct
28 Correct 85 ms 20452 KB Output is correct
29 Correct 84 ms 20336 KB Output is correct
30 Correct 75 ms 20028 KB Output is correct
31 Correct 1769 ms 126048 KB Output is correct
32 Correct 1625 ms 133528 KB Output is correct
33 Correct 1515 ms 126380 KB Output is correct
34 Correct 1283 ms 130356 KB Output is correct
35 Correct 1754 ms 124212 KB Output is correct
36 Correct 1714 ms 126492 KB Output is correct
37 Correct 1810 ms 134696 KB Output is correct
38 Correct 35 ms 15008 KB Output is correct
39 Correct 92 ms 20288 KB Output is correct
40 Correct 86 ms 20136 KB Output is correct
41 Correct 93 ms 20268 KB Output is correct
42 Correct 11 ms 12620 KB Output is correct
43 Correct 87 ms 20048 KB Output is correct
44 Correct 90 ms 19960 KB Output is correct
45 Correct 73 ms 20032 KB Output is correct
46 Correct 82 ms 20000 KB Output is correct
47 Correct 86 ms 20528 KB Output is correct
48 Correct 100 ms 20284 KB Output is correct
49 Correct 79 ms 20028 KB Output is correct
50 Correct 1668 ms 125980 KB Output is correct
51 Correct 1645 ms 133492 KB Output is correct
52 Correct 1536 ms 126316 KB Output is correct
53 Correct 1298 ms 130188 KB Output is correct
54 Correct 1698 ms 124232 KB Output is correct
55 Correct 1722 ms 126568 KB Output is correct
56 Correct 1793 ms 134824 KB Output is correct
57 Correct 2239 ms 150532 KB Output is correct
58 Correct 2493 ms 173708 KB Output is correct
59 Correct 2077 ms 155988 KB Output is correct
60 Correct 1201 ms 131432 KB Output is correct
61 Correct 2279 ms 154944 KB Output is correct
62 Correct 2218 ms 145484 KB Output is correct
63 Correct 9 ms 12020 KB Output is correct
64 Correct 8 ms 12108 KB Output is correct
65 Correct 10 ms 12108 KB Output is correct
66 Correct 35 ms 15048 KB Output is correct
67 Correct 76 ms 20412 KB Output is correct
68 Correct 71 ms 20196 KB Output is correct
69 Correct 79 ms 20380 KB Output is correct
70 Correct 10 ms 12620 KB Output is correct
71 Correct 106 ms 20040 KB Output is correct
72 Correct 76 ms 20032 KB Output is correct
73 Correct 70 ms 19972 KB Output is correct
74 Correct 69 ms 20024 KB Output is correct
75 Correct 87 ms 20540 KB Output is correct
76 Correct 76 ms 20264 KB Output is correct
77 Correct 72 ms 20100 KB Output is correct
78 Correct 1698 ms 127864 KB Output is correct
79 Correct 1657 ms 123024 KB Output is correct
80 Correct 1668 ms 122900 KB Output is correct
81 Correct 1499 ms 128160 KB Output is correct
82 Correct 1560 ms 124596 KB Output is correct
83 Correct 1559 ms 124052 KB Output is correct
84 Correct 1635 ms 124328 KB Output is correct
85 Correct 1761 ms 123852 KB Output is correct
86 Correct 1639 ms 124716 KB Output is correct
87 Correct 1650 ms 131448 KB Output is correct
88 Correct 1713 ms 131672 KB Output is correct
89 Correct 1854 ms 125276 KB Output is correct
90 Correct 1662 ms 124544 KB Output is correct
91 Correct 9 ms 12108 KB Output is correct
92 Correct 9 ms 12108 KB Output is correct
93 Correct 12 ms 12108 KB Output is correct
94 Correct 31 ms 15116 KB Output is correct
95 Correct 117 ms 20288 KB Output is correct
96 Correct 89 ms 20128 KB Output is correct
97 Correct 82 ms 20328 KB Output is correct
98 Correct 13 ms 12620 KB Output is correct
99 Correct 86 ms 20152 KB Output is correct
100 Correct 86 ms 20004 KB Output is correct
101 Correct 73 ms 20036 KB Output is correct
102 Correct 77 ms 20052 KB Output is correct
103 Correct 82 ms 20524 KB Output is correct
104 Correct 88 ms 20312 KB Output is correct
105 Correct 80 ms 19984 KB Output is correct
106 Correct 1756 ms 125892 KB Output is correct
107 Correct 1675 ms 133440 KB Output is correct
108 Correct 1518 ms 126440 KB Output is correct
109 Correct 1375 ms 130276 KB Output is correct
110 Correct 1775 ms 124260 KB Output is correct
111 Correct 1751 ms 126440 KB Output is correct
112 Correct 1871 ms 134732 KB Output is correct
113 Correct 1874 ms 127816 KB Output is correct
114 Correct 1797 ms 122996 KB Output is correct
115 Correct 1746 ms 122944 KB Output is correct
116 Correct 1587 ms 128192 KB Output is correct
117 Correct 1723 ms 124548 KB Output is correct
118 Correct 1722 ms 123964 KB Output is correct
119 Correct 1698 ms 124152 KB Output is correct
120 Correct 1748 ms 123868 KB Output is correct
121 Correct 1604 ms 124652 KB Output is correct
122 Correct 1700 ms 131300 KB Output is correct
123 Correct 1736 ms 131764 KB Output is correct
124 Correct 1903 ms 125232 KB Output is correct
125 Correct 1602 ms 124492 KB Output is correct
126 Correct 1759 ms 130364 KB Output is correct
127 Correct 1671 ms 130560 KB Output is correct
128 Correct 1702 ms 127076 KB Output is correct
129 Correct 1758 ms 129236 KB Output is correct
130 Correct 1666 ms 126908 KB Output is correct
131 Correct 1980 ms 127864 KB Output is correct
132 Correct 1888 ms 127468 KB Output is correct
133 Correct 10 ms 12108 KB Output is correct
134 Correct 9 ms 12004 KB Output is correct
135 Correct 9 ms 12108 KB Output is correct
136 Correct 31 ms 15076 KB Output is correct
137 Correct 105 ms 20332 KB Output is correct
138 Correct 84 ms 20124 KB Output is correct
139 Correct 109 ms 20336 KB Output is correct
140 Correct 11 ms 12620 KB Output is correct
141 Correct 76 ms 20140 KB Output is correct
142 Correct 73 ms 19988 KB Output is correct
143 Correct 82 ms 20032 KB Output is correct
144 Correct 83 ms 20044 KB Output is correct
145 Correct 102 ms 20456 KB Output is correct
146 Correct 81 ms 20288 KB Output is correct
147 Correct 105 ms 20108 KB Output is correct
148 Correct 1871 ms 125980 KB Output is correct
149 Correct 1647 ms 133316 KB Output is correct
150 Correct 1612 ms 125944 KB Output is correct
151 Correct 1277 ms 129640 KB Output is correct
152 Correct 1891 ms 123620 KB Output is correct
153 Correct 1919 ms 125648 KB Output is correct
154 Correct 1786 ms 133672 KB Output is correct
155 Correct 2492 ms 149412 KB Output is correct
156 Correct 3001 ms 172172 KB Output is correct
157 Correct 2465 ms 155424 KB Output is correct
158 Correct 1335 ms 131052 KB Output is correct
159 Correct 2602 ms 153468 KB Output is correct
160 Correct 2595 ms 144812 KB Output is correct
161 Correct 2005 ms 127452 KB Output is correct
162 Correct 1951 ms 122572 KB Output is correct
163 Correct 2016 ms 122180 KB Output is correct
164 Correct 1808 ms 127148 KB Output is correct
165 Correct 1800 ms 124124 KB Output is correct
166 Correct 1865 ms 123644 KB Output is correct
167 Correct 1824 ms 123956 KB Output is correct
168 Correct 1844 ms 123624 KB Output is correct
169 Correct 1789 ms 123976 KB Output is correct
170 Correct 1884 ms 130396 KB Output is correct
171 Correct 1846 ms 130688 KB Output is correct
172 Correct 2016 ms 124528 KB Output is correct
173 Correct 1836 ms 123900 KB Output is correct
174 Correct 1875 ms 129836 KB Output is correct
175 Correct 1590 ms 130460 KB Output is correct
176 Correct 1677 ms 126932 KB Output is correct
177 Correct 1791 ms 129588 KB Output is correct
178 Correct 1740 ms 127200 KB Output is correct
179 Correct 1835 ms 127552 KB Output is correct
180 Correct 1644 ms 127020 KB Output is correct
181 Correct 1984 ms 141148 KB Output is correct
182 Correct 1951 ms 143300 KB Output is correct
183 Correct 2538 ms 156624 KB Output is correct
184 Correct 2755 ms 156604 KB Output is correct
185 Correct 2547 ms 149620 KB Output is correct
186 Correct 2077 ms 139084 KB Output is correct
187 Correct 1895 ms 131636 KB Output is correct