Submission #658715

# Submission time Handle Problem Language Result Execution time Memory
658715 2022-11-14T13:37:50 Z Lobo From Hacks to Snitches (BOI21_watchmen) C++17
60 / 100
6000 ms 270268 KB
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define all(x) x.begin(),x.end()

const int inf = 1e9+10;
const int maxn = 3e5+10;
const int maxd = 5e6;

int n, m, k;
int szrt[maxn], idrt[maxn], thrt[maxn], isrt[maxn], nxrt[maxn], pvrt[maxn], dlol[maxn];
int fqt1[maxn];
int cntwtf = 0;
vector<int> g[maxn], gdiffrt[maxn], d[maxn];
vector<pair<int,int>> withdist[maxd+1];

int32_t main() {
    // freopen("in.in", "r", stdin);

    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int u,v; cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }

    cin >> k;
    for(int i = 1; i <= k; i++) {
        cin >> szrt[i];
        for(int j = 0; j < szrt[i]; j++) {
            int v; cin >> v;
            idrt[v] = i;
            isrt[v] = 1;
            thrt[v] = j;
        }
    }

    szrt[0] = 1;
    for(int i = 1; i <= n; i++) {
        dlol[i] = inf;
        if(isrt[i]) {
            for(int j = 0; j < szrt[idrt[i]]; j++) {
                d[i].pb(inf);
            }
            int u = i;
            for(auto v : g[u]) {
                if(isrt[v] && idrt[u] == idrt[v] && thrt[v] == (thrt[u]+1)%szrt[idrt[u]]) {
                    nxrt[u] = v;
                }
                if(isrt[v] && idrt[u] == idrt[v] && thrt[u] == (thrt[v]+1)%szrt[idrt[u]]) {
                    pvrt[u] = v;
                }

                if(isrt[v] && idrt[v] != idrt[u]) {
                    gdiffrt[u].pb(v);
                }
            }
        }
        else {
            d[i].pb(inf);
        }

    }

    d[1][0] = 0;
    withdist[0].pb(mp(1,0));
    for(int distcur = 0; distcur <= maxd; distcur++) {
    while(withdist[distcur].size()) {
        auto X = withdist[distcur].back();
        withdist[distcur].pop_back();
        int u = X.fr;
        int t = X.sc;
        if(t != -1 && distcur != d[u][t]) continue;
        if(t == -1 && distcur != dlol[u]) continue;

        if(t == -1) {
            for(auto v : g[u]) {
                if(isrt[v]) {
                    int d1 = dlol[u]+1;
                    int t1 = d1%szrt[idrt[v]];
                    // Vou encontrar o guarda em v ou indo para v
                    // indo para v == u é depois de v e em t1 ele vai estar em u
                    if(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u]) && idrt[u] == idrt[v]) continue;
                    if(d[v][t1] > d1) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }

                    // if(idrt[v] != idrt[u]) {
                    //     set<int> stt1;
                    //     d1 = dlol[u]+1;
                    //     while(true) {
                    //         int t1 = d1%szrt[idrt[v]];
                    //         if(stt1.count(t1)) break;
                    //         stt1.insert(t1);
                    //         // Vou encontrar o guarda em v ou indo para v
                    //         // indo para v == u é depois de v e em t1 ele vai estar em u
                    //         if(d[v][t1] > d1 && t1 != thrt[v]) {
                    //             d[v][t1] = d1;
                    //             withdist[d[v][t1]].pb(mp(v,t1));
                    //         }
                    //         d1+= szrt[idrt[u]];
                    //     }
                    // }
                }
                else {
                    int d1 = dlol[u]+1;
                    int t1 = 0;
                    if(d[v][t1] > d1) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }
                }
            }
            continue;
        }

        if(isrt[u]) {
            int v,d1,t1;
            v = nxrt[u];
            d1 = d[u][t]+1;
            t1 = d1%szrt[idrt[v]];
            // Vou encontrar o guarda em v ou indo para v
            // indo para v == u é depois de v e em t1 ele vai estar em u
            if(!(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u] && idrt[u] == idrt[v])) && d[v][t1] > d1) {
                d[v][t1] = d1;
                withdist[d[v][t1]].pb(mp(v,t1));
            }

            v = pvrt[u];
            d1 = d[u][t]+1;
            t1 = d1%szrt[idrt[v]];
            // Vou encontrar o guarda em v ou indo para v
            // indo para v == u é depois de v e em t1 ele vai estar em u
            if(!(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u] && idrt[u] == idrt[v])) && d[v][t1] > d1) {
                d[v][t1] = d1;
                withdist[d[v][t1]].pb(mp(v,t1));
            }

            if(dlol[u] > d[u][t]) {
                dlol[u] = d[u][t];
                withdist[dlol[u]].pb(mp(u,-1));
            }

            v = u;
            d1 = d[u][t]+1;
            t1 = d1%szrt[idrt[v]];
            if(!(t1 == thrt[v]) && d[v][t1] > d1) {
                d[v][t1] = d1;
                withdist[d[v][t1]].pb(mp(v,t1));
            }

            for(auto v : gdiffrt[u]) {
                set<int> stt1;
                d1 = d[u][t]+1;
                ++cntwtf;
                while(true) {
                    int t1 = d1%szrt[idrt[v]];
                    if(stt1.count(t1)) break;
                    stt1.insert(t1);
                    if(fqt1[t1] == cntwtf) break;
                    fqt1[t1] = cntwtf;
                    // Vou encontrar o guarda em v ou indo para v
                    // indo para v == u é depois de v e em t1 ele vai estar em u
                    if(d[v][t1] > d1 && t1 != thrt[v]) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }
                    d1+= szrt[idrt[u]];
                }
            }
        }
        else {
            for(auto v : g[u]) {
                if(isrt[v]) {
                    // d[u][t]+1+i = (thrt[v]+1) MOD
                    // i = trrt[v]-d[u][t] MOD
                    int i = ((thrt[v]-d[u][t])%szrt[idrt[v]]+szrt[idrt[v]])%szrt[idrt[v]];
                    int d1 = d[u][t]+1+i;
                    int t1 = d1%szrt[idrt[v]];
                    if(t1 == thrt[v]) continue;
                    if(d[v][t1] > d1) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }
                    d1 = d[u][t]+1;
                    t1 = d1%szrt[idrt[v]];
                    if(t1 == thrt[v]) continue;
                    if(d[v][t1] > d1) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }
                }
                else {
                    int d1 = d[u][t]+1;
                    int t1 = 0;
                    if(d[v][t1] > d1) {
                        d[v][t1] = d1;
                        withdist[d[v][t1]].pb(mp(v,t1));
                    }
                }
            }
        }
    }
    }

    if(d[n][0] == inf) cout << "impossible" << endl;
    else cout << d[n][0] << endl;
}

Compilation message

watchmen.cpp: In function 'int32_t main()':
watchmen.cpp:87:97: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   87 |                     if(t1 == thrt[v] || (thrt[u] == (thrt[v]+1)%szrt[idrt[u]] && t1 == thrt[u]) && idrt[u] == idrt[v]) continue;
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 110 ms 140492 KB Output is correct
2 Correct 185 ms 151004 KB Output is correct
3 Correct 184 ms 149460 KB Output is correct
4 Correct 167 ms 149196 KB Output is correct
5 Correct 80 ms 139084 KB Output is correct
6 Correct 174 ms 149192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 140484 KB Output is correct
2 Correct 195 ms 150860 KB Output is correct
3 Correct 187 ms 149464 KB Output is correct
4 Correct 186 ms 149216 KB Output is correct
5 Correct 76 ms 139016 KB Output is correct
6 Correct 190 ms 149260 KB Output is correct
7 Correct 221 ms 149548 KB Output is correct
8 Correct 177 ms 149584 KB Output is correct
9 Correct 177 ms 149864 KB Output is correct
10 Correct 207 ms 148592 KB Output is correct
11 Correct 165 ms 148228 KB Output is correct
12 Correct 163 ms 149072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 140484 KB Output is correct
2 Correct 195 ms 150860 KB Output is correct
3 Correct 187 ms 149464 KB Output is correct
4 Correct 186 ms 149216 KB Output is correct
5 Correct 76 ms 139016 KB Output is correct
6 Correct 190 ms 149260 KB Output is correct
7 Correct 221 ms 149548 KB Output is correct
8 Correct 177 ms 149584 KB Output is correct
9 Correct 177 ms 149864 KB Output is correct
10 Correct 207 ms 148592 KB Output is correct
11 Correct 165 ms 148228 KB Output is correct
12 Correct 163 ms 149072 KB Output is correct
13 Correct 109 ms 140476 KB Output is correct
14 Correct 182 ms 150860 KB Output is correct
15 Correct 173 ms 149376 KB Output is correct
16 Correct 180 ms 149172 KB Output is correct
17 Correct 90 ms 139140 KB Output is correct
18 Correct 222 ms 149264 KB Output is correct
19 Correct 183 ms 149432 KB Output is correct
20 Correct 168 ms 149580 KB Output is correct
21 Correct 189 ms 149708 KB Output is correct
22 Correct 171 ms 148504 KB Output is correct
23 Correct 193 ms 148200 KB Output is correct
24 Correct 187 ms 149040 KB Output is correct
25 Correct 2938 ms 202112 KB Output is correct
26 Correct 3038 ms 209904 KB Output is correct
27 Correct 2921 ms 206072 KB Output is correct
28 Correct 2730 ms 210656 KB Output is correct
29 Correct 2801 ms 197616 KB Output is correct
30 Correct 2770 ms 201640 KB Output is correct
31 Correct 3088 ms 209848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 140484 KB Output is correct
2 Correct 195 ms 150860 KB Output is correct
3 Correct 187 ms 149464 KB Output is correct
4 Correct 186 ms 149216 KB Output is correct
5 Correct 76 ms 139016 KB Output is correct
6 Correct 190 ms 149260 KB Output is correct
7 Correct 221 ms 149548 KB Output is correct
8 Correct 177 ms 149584 KB Output is correct
9 Correct 177 ms 149864 KB Output is correct
10 Correct 207 ms 148592 KB Output is correct
11 Correct 165 ms 148228 KB Output is correct
12 Correct 163 ms 149072 KB Output is correct
13 Correct 109 ms 140476 KB Output is correct
14 Correct 182 ms 150860 KB Output is correct
15 Correct 173 ms 149376 KB Output is correct
16 Correct 180 ms 149172 KB Output is correct
17 Correct 90 ms 139140 KB Output is correct
18 Correct 222 ms 149264 KB Output is correct
19 Correct 183 ms 149432 KB Output is correct
20 Correct 168 ms 149580 KB Output is correct
21 Correct 189 ms 149708 KB Output is correct
22 Correct 171 ms 148504 KB Output is correct
23 Correct 193 ms 148200 KB Output is correct
24 Correct 187 ms 149040 KB Output is correct
25 Correct 2938 ms 202112 KB Output is correct
26 Correct 3038 ms 209904 KB Output is correct
27 Correct 2921 ms 206072 KB Output is correct
28 Correct 2730 ms 210656 KB Output is correct
29 Correct 2801 ms 197616 KB Output is correct
30 Correct 2770 ms 201640 KB Output is correct
31 Correct 3088 ms 209848 KB Output is correct
32 Correct 158 ms 140544 KB Output is correct
33 Correct 199 ms 151292 KB Output is correct
34 Correct 211 ms 149764 KB Output is correct
35 Correct 227 ms 149568 KB Output is correct
36 Correct 88 ms 139084 KB Output is correct
37 Correct 201 ms 149636 KB Output is correct
38 Correct 200 ms 149796 KB Output is correct
39 Correct 210 ms 150000 KB Output is correct
40 Correct 195 ms 150132 KB Output is correct
41 Correct 184 ms 148940 KB Output is correct
42 Correct 177 ms 148460 KB Output is correct
43 Correct 200 ms 149580 KB Output is correct
44 Correct 2932 ms 200404 KB Output is correct
45 Correct 2946 ms 207000 KB Output is correct
46 Correct 2933 ms 199824 KB Output is correct
47 Correct 2565 ms 210880 KB Output is correct
48 Correct 2800 ms 191204 KB Output is correct
49 Correct 3092 ms 196720 KB Output is correct
50 Correct 3065 ms 204908 KB Output is correct
51 Correct 3243 ms 238472 KB Output is correct
52 Correct 3330 ms 270268 KB Output is correct
53 Correct 2991 ms 240196 KB Output is correct
54 Correct 2400 ms 210324 KB Output is correct
55 Correct 3055 ms 235352 KB Output is correct
56 Correct 2989 ms 216512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 140492 KB Output is correct
2 Correct 185 ms 151004 KB Output is correct
3 Correct 184 ms 149460 KB Output is correct
4 Correct 167 ms 149196 KB Output is correct
5 Correct 80 ms 139084 KB Output is correct
6 Correct 174 ms 149192 KB Output is correct
7 Correct 115 ms 140484 KB Output is correct
8 Correct 195 ms 150860 KB Output is correct
9 Correct 187 ms 149464 KB Output is correct
10 Correct 186 ms 149216 KB Output is correct
11 Correct 76 ms 139016 KB Output is correct
12 Correct 190 ms 149260 KB Output is correct
13 Correct 221 ms 149548 KB Output is correct
14 Correct 177 ms 149584 KB Output is correct
15 Correct 177 ms 149864 KB Output is correct
16 Correct 207 ms 148592 KB Output is correct
17 Correct 165 ms 148228 KB Output is correct
18 Correct 163 ms 149072 KB Output is correct
19 Correct 105 ms 138868 KB Output is correct
20 Correct 81 ms 138912 KB Output is correct
21 Correct 82 ms 138860 KB Output is correct
22 Correct 124 ms 140444 KB Output is correct
23 Correct 195 ms 151304 KB Output is correct
24 Correct 202 ms 149900 KB Output is correct
25 Correct 215 ms 149580 KB Output is correct
26 Correct 92 ms 139036 KB Output is correct
27 Correct 185 ms 149760 KB Output is correct
28 Correct 218 ms 149784 KB Output is correct
29 Correct 198 ms 149988 KB Output is correct
30 Correct 194 ms 150152 KB Output is correct
31 Correct 199 ms 148944 KB Output is correct
32 Correct 214 ms 148384 KB Output is correct
33 Correct 193 ms 149544 KB Output is correct
34 Correct 3072 ms 194436 KB Output is correct
35 Correct 3118 ms 196900 KB Output is correct
36 Correct 3127 ms 191828 KB Output is correct
37 Correct 2780 ms 197396 KB Output is correct
38 Correct 2908 ms 199256 KB Output is correct
39 Correct 2772 ms 191212 KB Output is correct
40 Correct 4067 ms 191560 KB Output is correct
41 Correct 3475 ms 189360 KB Output is correct
42 Correct 2696 ms 195196 KB Output is correct
43 Correct 2785 ms 195820 KB Output is correct
44 Correct 2764 ms 198124 KB Output is correct
45 Correct 3070 ms 194276 KB Output is correct
46 Correct 3058 ms 197732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 140492 KB Output is correct
2 Correct 185 ms 151004 KB Output is correct
3 Correct 184 ms 149460 KB Output is correct
4 Correct 167 ms 149196 KB Output is correct
5 Correct 80 ms 139084 KB Output is correct
6 Correct 174 ms 149192 KB Output is correct
7 Correct 115 ms 140484 KB Output is correct
8 Correct 195 ms 150860 KB Output is correct
9 Correct 187 ms 149464 KB Output is correct
10 Correct 186 ms 149216 KB Output is correct
11 Correct 76 ms 139016 KB Output is correct
12 Correct 190 ms 149260 KB Output is correct
13 Correct 221 ms 149548 KB Output is correct
14 Correct 177 ms 149584 KB Output is correct
15 Correct 177 ms 149864 KB Output is correct
16 Correct 207 ms 148592 KB Output is correct
17 Correct 165 ms 148228 KB Output is correct
18 Correct 163 ms 149072 KB Output is correct
19 Correct 109 ms 140476 KB Output is correct
20 Correct 182 ms 150860 KB Output is correct
21 Correct 173 ms 149376 KB Output is correct
22 Correct 180 ms 149172 KB Output is correct
23 Correct 90 ms 139140 KB Output is correct
24 Correct 222 ms 149264 KB Output is correct
25 Correct 183 ms 149432 KB Output is correct
26 Correct 168 ms 149580 KB Output is correct
27 Correct 189 ms 149708 KB Output is correct
28 Correct 171 ms 148504 KB Output is correct
29 Correct 193 ms 148200 KB Output is correct
30 Correct 187 ms 149040 KB Output is correct
31 Correct 2938 ms 202112 KB Output is correct
32 Correct 3038 ms 209904 KB Output is correct
33 Correct 2921 ms 206072 KB Output is correct
34 Correct 2730 ms 210656 KB Output is correct
35 Correct 2801 ms 197616 KB Output is correct
36 Correct 2770 ms 201640 KB Output is correct
37 Correct 3088 ms 209848 KB Output is correct
38 Correct 105 ms 138868 KB Output is correct
39 Correct 81 ms 138912 KB Output is correct
40 Correct 82 ms 138860 KB Output is correct
41 Correct 124 ms 140444 KB Output is correct
42 Correct 195 ms 151304 KB Output is correct
43 Correct 202 ms 149900 KB Output is correct
44 Correct 215 ms 149580 KB Output is correct
45 Correct 92 ms 139036 KB Output is correct
46 Correct 185 ms 149760 KB Output is correct
47 Correct 218 ms 149784 KB Output is correct
48 Correct 198 ms 149988 KB Output is correct
49 Correct 194 ms 150152 KB Output is correct
50 Correct 199 ms 148944 KB Output is correct
51 Correct 214 ms 148384 KB Output is correct
52 Correct 193 ms 149544 KB Output is correct
53 Correct 3072 ms 194436 KB Output is correct
54 Correct 3118 ms 196900 KB Output is correct
55 Correct 3127 ms 191828 KB Output is correct
56 Correct 2780 ms 197396 KB Output is correct
57 Correct 2908 ms 199256 KB Output is correct
58 Correct 2772 ms 191212 KB Output is correct
59 Correct 4067 ms 191560 KB Output is correct
60 Correct 3475 ms 189360 KB Output is correct
61 Correct 2696 ms 195196 KB Output is correct
62 Correct 2785 ms 195820 KB Output is correct
63 Correct 2764 ms 198124 KB Output is correct
64 Correct 3070 ms 194276 KB Output is correct
65 Correct 3058 ms 197732 KB Output is correct
66 Correct 95 ms 138820 KB Output is correct
67 Correct 100 ms 138856 KB Output is correct
68 Correct 98 ms 138776 KB Output is correct
69 Correct 148 ms 140436 KB Output is correct
70 Correct 198 ms 150868 KB Output is correct
71 Correct 190 ms 149824 KB Output is correct
72 Correct 200 ms 149596 KB Output is correct
73 Correct 91 ms 139056 KB Output is correct
74 Correct 192 ms 148500 KB Output is correct
75 Correct 194 ms 149736 KB Output is correct
76 Correct 205 ms 149928 KB Output is correct
77 Correct 202 ms 149224 KB Output is correct
78 Correct 198 ms 148924 KB Output is correct
79 Correct 185 ms 147948 KB Output is correct
80 Correct 189 ms 149452 KB Output is correct
81 Correct 2874 ms 197752 KB Output is correct
82 Correct 2688 ms 204444 KB Output is correct
83 Correct 2651 ms 199488 KB Output is correct
84 Correct 2507 ms 204596 KB Output is correct
85 Correct 2672 ms 191064 KB Output is correct
86 Correct 2869 ms 197528 KB Output is correct
87 Correct 3202 ms 203296 KB Output is correct
88 Correct 3115 ms 196360 KB Output is correct
89 Correct 3116 ms 192284 KB Output is correct
90 Correct 3130 ms 197320 KB Output is correct
91 Correct 2843 ms 197508 KB Output is correct
92 Correct 3238 ms 198424 KB Output is correct
93 Correct 2804 ms 191672 KB Output is correct
94 Correct 4112 ms 192236 KB Output is correct
95 Correct 3045 ms 189348 KB Output is correct
96 Correct 2913 ms 195276 KB Output is correct
97 Correct 3144 ms 198320 KB Output is correct
98 Correct 3101 ms 200240 KB Output is correct
99 Correct 3136 ms 192780 KB Output is correct
100 Correct 2943 ms 196936 KB Output is correct
101 Correct 3049 ms 197540 KB Output is correct
102 Correct 2941 ms 199972 KB Output is correct
103 Correct 2960 ms 199220 KB Output is correct
104 Execution timed out 6029 ms 193800 KB Time limit exceeded
105 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 110 ms 140492 KB Output is correct
2 Correct 185 ms 151004 KB Output is correct
3 Correct 184 ms 149460 KB Output is correct
4 Correct 167 ms 149196 KB Output is correct
5 Correct 80 ms 139084 KB Output is correct
6 Correct 174 ms 149192 KB Output is correct
7 Correct 115 ms 140484 KB Output is correct
8 Correct 195 ms 150860 KB Output is correct
9 Correct 187 ms 149464 KB Output is correct
10 Correct 186 ms 149216 KB Output is correct
11 Correct 76 ms 139016 KB Output is correct
12 Correct 190 ms 149260 KB Output is correct
13 Correct 221 ms 149548 KB Output is correct
14 Correct 177 ms 149584 KB Output is correct
15 Correct 177 ms 149864 KB Output is correct
16 Correct 207 ms 148592 KB Output is correct
17 Correct 165 ms 148228 KB Output is correct
18 Correct 163 ms 149072 KB Output is correct
19 Correct 109 ms 140476 KB Output is correct
20 Correct 182 ms 150860 KB Output is correct
21 Correct 173 ms 149376 KB Output is correct
22 Correct 180 ms 149172 KB Output is correct
23 Correct 90 ms 139140 KB Output is correct
24 Correct 222 ms 149264 KB Output is correct
25 Correct 183 ms 149432 KB Output is correct
26 Correct 168 ms 149580 KB Output is correct
27 Correct 189 ms 149708 KB Output is correct
28 Correct 171 ms 148504 KB Output is correct
29 Correct 193 ms 148200 KB Output is correct
30 Correct 187 ms 149040 KB Output is correct
31 Correct 2938 ms 202112 KB Output is correct
32 Correct 3038 ms 209904 KB Output is correct
33 Correct 2921 ms 206072 KB Output is correct
34 Correct 2730 ms 210656 KB Output is correct
35 Correct 2801 ms 197616 KB Output is correct
36 Correct 2770 ms 201640 KB Output is correct
37 Correct 3088 ms 209848 KB Output is correct
38 Correct 158 ms 140544 KB Output is correct
39 Correct 199 ms 151292 KB Output is correct
40 Correct 211 ms 149764 KB Output is correct
41 Correct 227 ms 149568 KB Output is correct
42 Correct 88 ms 139084 KB Output is correct
43 Correct 201 ms 149636 KB Output is correct
44 Correct 200 ms 149796 KB Output is correct
45 Correct 210 ms 150000 KB Output is correct
46 Correct 195 ms 150132 KB Output is correct
47 Correct 184 ms 148940 KB Output is correct
48 Correct 177 ms 148460 KB Output is correct
49 Correct 200 ms 149580 KB Output is correct
50 Correct 2932 ms 200404 KB Output is correct
51 Correct 2946 ms 207000 KB Output is correct
52 Correct 2933 ms 199824 KB Output is correct
53 Correct 2565 ms 210880 KB Output is correct
54 Correct 2800 ms 191204 KB Output is correct
55 Correct 3092 ms 196720 KB Output is correct
56 Correct 3065 ms 204908 KB Output is correct
57 Correct 3243 ms 238472 KB Output is correct
58 Correct 3330 ms 270268 KB Output is correct
59 Correct 2991 ms 240196 KB Output is correct
60 Correct 2400 ms 210324 KB Output is correct
61 Correct 3055 ms 235352 KB Output is correct
62 Correct 2989 ms 216512 KB Output is correct
63 Correct 105 ms 138868 KB Output is correct
64 Correct 81 ms 138912 KB Output is correct
65 Correct 82 ms 138860 KB Output is correct
66 Correct 124 ms 140444 KB Output is correct
67 Correct 195 ms 151304 KB Output is correct
68 Correct 202 ms 149900 KB Output is correct
69 Correct 215 ms 149580 KB Output is correct
70 Correct 92 ms 139036 KB Output is correct
71 Correct 185 ms 149760 KB Output is correct
72 Correct 218 ms 149784 KB Output is correct
73 Correct 198 ms 149988 KB Output is correct
74 Correct 194 ms 150152 KB Output is correct
75 Correct 199 ms 148944 KB Output is correct
76 Correct 214 ms 148384 KB Output is correct
77 Correct 193 ms 149544 KB Output is correct
78 Correct 3072 ms 194436 KB Output is correct
79 Correct 3118 ms 196900 KB Output is correct
80 Correct 3127 ms 191828 KB Output is correct
81 Correct 2780 ms 197396 KB Output is correct
82 Correct 2908 ms 199256 KB Output is correct
83 Correct 2772 ms 191212 KB Output is correct
84 Correct 4067 ms 191560 KB Output is correct
85 Correct 3475 ms 189360 KB Output is correct
86 Correct 2696 ms 195196 KB Output is correct
87 Correct 2785 ms 195820 KB Output is correct
88 Correct 2764 ms 198124 KB Output is correct
89 Correct 3070 ms 194276 KB Output is correct
90 Correct 3058 ms 197732 KB Output is correct
91 Correct 95 ms 138820 KB Output is correct
92 Correct 100 ms 138856 KB Output is correct
93 Correct 98 ms 138776 KB Output is correct
94 Correct 148 ms 140436 KB Output is correct
95 Correct 198 ms 150868 KB Output is correct
96 Correct 190 ms 149824 KB Output is correct
97 Correct 200 ms 149596 KB Output is correct
98 Correct 91 ms 139056 KB Output is correct
99 Correct 192 ms 148500 KB Output is correct
100 Correct 194 ms 149736 KB Output is correct
101 Correct 205 ms 149928 KB Output is correct
102 Correct 202 ms 149224 KB Output is correct
103 Correct 198 ms 148924 KB Output is correct
104 Correct 185 ms 147948 KB Output is correct
105 Correct 189 ms 149452 KB Output is correct
106 Correct 2874 ms 197752 KB Output is correct
107 Correct 2688 ms 204444 KB Output is correct
108 Correct 2651 ms 199488 KB Output is correct
109 Correct 2507 ms 204596 KB Output is correct
110 Correct 2672 ms 191064 KB Output is correct
111 Correct 2869 ms 197528 KB Output is correct
112 Correct 3202 ms 203296 KB Output is correct
113 Correct 3115 ms 196360 KB Output is correct
114 Correct 3116 ms 192284 KB Output is correct
115 Correct 3130 ms 197320 KB Output is correct
116 Correct 2843 ms 197508 KB Output is correct
117 Correct 3238 ms 198424 KB Output is correct
118 Correct 2804 ms 191672 KB Output is correct
119 Correct 4112 ms 192236 KB Output is correct
120 Correct 3045 ms 189348 KB Output is correct
121 Correct 2913 ms 195276 KB Output is correct
122 Correct 3144 ms 198320 KB Output is correct
123 Correct 3101 ms 200240 KB Output is correct
124 Correct 3136 ms 192780 KB Output is correct
125 Correct 2943 ms 196936 KB Output is correct
126 Correct 3049 ms 197540 KB Output is correct
127 Correct 2941 ms 199972 KB Output is correct
128 Correct 2960 ms 199220 KB Output is correct
129 Execution timed out 6029 ms 193800 KB Time limit exceeded
130 Halted 0 ms 0 KB -