Submission #986071

# Submission time Handle Problem Language Result Execution time Memory
986071 2024-05-19T17:32:45 Z VinhLuu Maze (JOI23_ho_t3) C++17
62 / 100
415 ms 641296 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
//#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define all(lmao) lmao.begin(), lmao.end()

using namespace std;

typedef pair<int,int> pii;
typedef tuple<ll,int,int> tp;
const int N = 6e6 + 5;
const ll oo = 1e14 + 1;
const int mod = 1e9 + 7;
//const ll oo = 5e18;

const int ha[4] = {1, -1, 0, 0};
const int co[4] = {0, 0, 1, -1};

int m, n, k, xt, yt, xs, ys;

ll ans;

vector<ll> f[N];
vector<int> a[N], ph[N], pc[N];
deque<tp> q;

bool kt(int x,int y){
    return x >= 1 && x <= m && y >= 1 && y <= n;
}

int row(int u,int v){
    return (ph[u][v] == v ? v : ph[u][v] = row(u, ph[u][v]));
}

int col(int u,int v){
    return (pc[u][v] == u ? u : pc[u][v] = col(pc[u][v], v));
}

void conduct(ll val,int x,int y){
    int l = max(1, x - k + 1), r = min(m, x + k - 1), pl = max(1, y - k + 1), pr = min(n, y + k - 1);
    if(xt >= l && xt <= r && yt >= pl && yt <= pr) ans = min(ans, val + 1);
    if(l - 1 >= 1){
        int lx = l - 1, g = pr;
        while(ph[lx][g] >= pl){
            g = ph[lx][g];
            if(f[lx][g] > val + 1) f[lx][g] = val + 1, q.push_back({f[lx][g], lx, g});
            if(!ph[lx][g]) break;
            ph[lx][g]--;
            ph[lx][g] = row(lx, ph[lx][g]);
        }
    }
    if(r + 1 <= m){
        int lx = r + 1, g = pr;
        while(ph[lx][g] >= pl){
            g = ph[lx][g];
            if(f[lx][g] > val + 1) f[lx][g] = val + 1, q.push_back({f[lx][g], lx, g});
            if(!ph[lx][g]) break;
            ph[lx][g]--;
            ph[lx][g] = row(lx, ph[lx][g]);
        }
    }
    if(pl - 1 >= 1){
        int g = r, ly = pl - 1;
        while(pc[g][ly] >= l){
            g = pc[g][ly];
            if(f[g][ly] > val + 1) f[g][ly] = val + 1, q.push_back({f[g][ly], g, ly});
            if(!pc[g][ly]) break;
            pc[g][ly]--;
            pc[g][ly] = col(pc[g][ly], ly);
        }
    }

    if(pr + 1 <= n){
        int g = r, ly = pr + 1;
        while(pc[g][ly] >= l){
            g = pc[g][ly];
            if(f[g][ly] > val + 1) f[g][ly] = val + 1, q.push_back({f[g][ly], g, ly});
            if(!pc[g][ly]) break;
            pc[g][ly]--;
            pc[g][ly] = col(pc[g][ly], ly);
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #define task "v"
    if(fopen(task ".inp","r")){
        freopen(task ".inp","r",stdin);
        freopen(task ".out","w",stdout);
    }

    cin >> m >> n >> k;
    cin >> xs >> ys >> xt >> yt;
    for(int i = 1; i <= m; i ++){
        string s; cin >> s;
        f[i].pb(oo);
        a[i].pb(0);
        ph[i].pb(0);
        pc[i].pb(0);
        for(int j = 0; j < n; j ++){
            f[i].pb(oo);
            pc[i].pb(0);
            ph[i].pb(j + 1);
            if(s[j] == '.') a[i].pb(0);
            else a[i].pb(1);
        }
        f[i].pb(oo);
        a[i].pb(0);
        ph[i].pb(0);
        pc[i].pb(0);
    }
    for(int i = 1; i <= n + 1; i ++) pc[0].pb(0);
    for(int i = 1; i <= n; i ++){
        for(int j = 1; j <= m; j ++){
            pc[j][i] = j;
        }
    }

    f[xs][ys] = 0;
    q.push_back({0, xs, ys});

    ans = oo;
    while(!q.empty()){
        ll val;
        int px, py; tie(val, px, py) = q.front();
        q.pop_front();
        if(val > f[px][py]) continue;
        if(px == xt && py == yt) ans = min(ans, f[px][py]);
        int tx = abs(xt - px), ty = abs(yt - py);
        if(min(tx, ty) < k && max(tx, ty) <= k && f[xt][yt] > val + 1){
            f[xt][yt] = val + 1;
            q.push_back({f[xt][yt], xt, yt});
        }

        conduct(val, px, py);

        for(int d = 0; d < 4; d ++){
            int x = px + ha[d];
            int y = py + co[d];
            if(!kt(x, y) || f[x][y] <= f[px][py] || a[x][y]) continue;
            f[x][y] = f[px][py];
            q.push_front({f[x][y], x, y});
//            if(ph[x][y]){
//                ph[x][y]--;
//                ph[x][y] = row(x, ph[x][y]);
//            }
//            if(pc[x][y]){
//                pc[x][y]--;
//                pc[x][y] = col(pc[x][y], y);
//            }
        }
    }
    cout << min(ans, f[xt][yt]);
}

/*
6 6 3
5 4
2 1
###.#.
#..#..
...###
###.##
..#.##
#.#...
*/

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:94:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   94 |         freopen(task ".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:95:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   95 |         freopen(task ".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 196 ms 564032 KB Output is correct
2 Correct 198 ms 563812 KB Output is correct
3 Correct 195 ms 564068 KB Output is correct
4 Correct 196 ms 564052 KB Output is correct
5 Correct 198 ms 564076 KB Output is correct
6 Correct 278 ms 564072 KB Output is correct
7 Correct 195 ms 563976 KB Output is correct
8 Correct 203 ms 564300 KB Output is correct
9 Correct 196 ms 563984 KB Output is correct
10 Correct 199 ms 563800 KB Output is correct
11 Correct 202 ms 564308 KB Output is correct
12 Correct 201 ms 563792 KB Output is correct
13 Correct 199 ms 563796 KB Output is correct
14 Correct 202 ms 563792 KB Output is correct
15 Correct 197 ms 563792 KB Output is correct
16 Correct 199 ms 563908 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 198 ms 564052 KB Output is correct
19 Correct 205 ms 565208 KB Output is correct
20 Correct 208 ms 565848 KB Output is correct
21 Correct 212 ms 566124 KB Output is correct
22 Correct 204 ms 565072 KB Output is correct
23 Correct 205 ms 565328 KB Output is correct
24 Correct 199 ms 565708 KB Output is correct
25 Correct 200 ms 565908 KB Output is correct
26 Correct 212 ms 565664 KB Output is correct
27 Correct 208 ms 565328 KB Output is correct
28 Correct 203 ms 565328 KB Output is correct
29 Correct 210 ms 567956 KB Output is correct
30 Correct 202 ms 565400 KB Output is correct
31 Correct 207 ms 571476 KB Output is correct
32 Correct 220 ms 568156 KB Output is correct
33 Correct 217 ms 567964 KB Output is correct
34 Correct 205 ms 568992 KB Output is correct
35 Correct 206 ms 569016 KB Output is correct
36 Correct 217 ms 568144 KB Output is correct
37 Correct 217 ms 568080 KB Output is correct
38 Correct 206 ms 567892 KB Output is correct
39 Correct 351 ms 610132 KB Output is correct
40 Correct 220 ms 568404 KB Output is correct
41 Correct 211 ms 569492 KB Output is correct
42 Correct 220 ms 570848 KB Output is correct
43 Correct 220 ms 570312 KB Output is correct
44 Correct 272 ms 579976 KB Output is correct
45 Correct 267 ms 586084 KB Output is correct
46 Correct 321 ms 641296 KB Output is correct
47 Correct 384 ms 610192 KB Output is correct
48 Correct 367 ms 610340 KB Output is correct
49 Correct 280 ms 609868 KB Output is correct
50 Correct 279 ms 609872 KB Output is correct
51 Correct 391 ms 611156 KB Output is correct
52 Correct 415 ms 610684 KB Output is correct
53 Correct 358 ms 610388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 563828 KB Output is correct
2 Correct 199 ms 563796 KB Output is correct
3 Correct 199 ms 564036 KB Output is correct
4 Correct 197 ms 563844 KB Output is correct
5 Correct 196 ms 564052 KB Output is correct
6 Correct 200 ms 563832 KB Output is correct
7 Correct 197 ms 563792 KB Output is correct
8 Correct 197 ms 564048 KB Output is correct
9 Correct 197 ms 564052 KB Output is correct
10 Correct 200 ms 564080 KB Output is correct
11 Correct 204 ms 564308 KB Output is correct
12 Correct 197 ms 563840 KB Output is correct
13 Correct 195 ms 564048 KB Output is correct
14 Correct 205 ms 564484 KB Output is correct
15 Correct 201 ms 564048 KB Output is correct
16 Correct 198 ms 564304 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 197 ms 563796 KB Output is correct
19 Correct 198 ms 563844 KB Output is correct
20 Correct 200 ms 563844 KB Output is correct
21 Correct 201 ms 563792 KB Output is correct
22 Correct 202 ms 564052 KB Output is correct
23 Correct 197 ms 564040 KB Output is correct
24 Correct 203 ms 564032 KB Output is correct
25 Correct 201 ms 563960 KB Output is correct
26 Correct 200 ms 563796 KB Output is correct
27 Correct 200 ms 564032 KB Output is correct
28 Correct 198 ms 564048 KB Output is correct
29 Correct 199 ms 563980 KB Output is correct
30 Correct 202 ms 564052 KB Output is correct
31 Correct 197 ms 564056 KB Output is correct
32 Correct 196 ms 564076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 202 ms 563792 KB Output is correct
2 Correct 201 ms 564052 KB Output is correct
3 Correct 201 ms 563904 KB Output is correct
4 Correct 197 ms 563800 KB Output is correct
5 Correct 201 ms 563796 KB Output is correct
6 Correct 196 ms 563792 KB Output is correct
7 Correct 200 ms 564052 KB Output is correct
8 Correct 208 ms 564304 KB Output is correct
9 Correct 199 ms 563828 KB Output is correct
10 Correct 199 ms 564048 KB Output is correct
11 Correct 203 ms 563936 KB Output is correct
12 Correct 198 ms 564056 KB Output is correct
13 Correct 202 ms 563924 KB Output is correct
14 Correct 201 ms 564304 KB Output is correct
15 Correct 204 ms 563980 KB Output is correct
16 Correct 200 ms 564044 KB Output is correct
17 Correct 199 ms 564052 KB Output is correct
18 Correct 198 ms 563872 KB Output is correct
19 Correct 199 ms 564052 KB Output is correct
20 Correct 199 ms 563796 KB Output is correct
21 Correct 202 ms 564048 KB Output is correct
22 Correct 198 ms 564048 KB Output is correct
23 Correct 203 ms 564312 KB Output is correct
24 Correct 210 ms 564312 KB Output is correct
25 Correct 207 ms 565336 KB Output is correct
26 Correct 205 ms 566784 KB Output is correct
27 Correct 204 ms 566096 KB Output is correct
28 Correct 201 ms 565844 KB Output is correct
29 Correct 199 ms 565072 KB Output is correct
30 Correct 235 ms 565076 KB Output is correct
31 Correct 203 ms 565428 KB Output is correct
32 Correct 246 ms 565332 KB Output is correct
33 Correct 202 ms 565332 KB Output is correct
34 Correct 216 ms 570240 KB Output is correct
35 Correct 210 ms 571528 KB Output is correct
36 Correct 205 ms 568916 KB Output is correct
37 Correct 200 ms 567888 KB Output is correct
38 Correct 198 ms 567888 KB Output is correct
39 Correct 253 ms 584020 KB Output is correct
40 Correct 351 ms 615172 KB Output is correct
41 Correct 324 ms 641256 KB Output is correct
42 Correct 266 ms 617044 KB Output is correct
43 Correct 232 ms 610252 KB Output is correct
44 Correct 233 ms 610252 KB Output is correct
45 Correct 342 ms 623104 KB Output is correct
46 Correct 343 ms 621560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 563828 KB Output is correct
2 Correct 199 ms 563796 KB Output is correct
3 Correct 199 ms 564036 KB Output is correct
4 Correct 197 ms 563844 KB Output is correct
5 Correct 196 ms 564052 KB Output is correct
6 Correct 200 ms 563832 KB Output is correct
7 Correct 197 ms 563792 KB Output is correct
8 Correct 197 ms 564048 KB Output is correct
9 Correct 197 ms 564052 KB Output is correct
10 Correct 200 ms 564080 KB Output is correct
11 Correct 204 ms 564308 KB Output is correct
12 Correct 197 ms 563840 KB Output is correct
13 Correct 195 ms 564048 KB Output is correct
14 Correct 205 ms 564484 KB Output is correct
15 Correct 201 ms 564048 KB Output is correct
16 Correct 198 ms 564304 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 197 ms 563796 KB Output is correct
19 Correct 198 ms 563844 KB Output is correct
20 Correct 200 ms 563844 KB Output is correct
21 Correct 201 ms 563792 KB Output is correct
22 Correct 202 ms 564052 KB Output is correct
23 Correct 197 ms 564040 KB Output is correct
24 Correct 203 ms 564032 KB Output is correct
25 Correct 201 ms 563960 KB Output is correct
26 Correct 200 ms 563796 KB Output is correct
27 Correct 200 ms 564032 KB Output is correct
28 Correct 198 ms 564048 KB Output is correct
29 Correct 199 ms 563980 KB Output is correct
30 Correct 202 ms 564052 KB Output is correct
31 Correct 197 ms 564056 KB Output is correct
32 Correct 196 ms 564076 KB Output is correct
33 Correct 202 ms 565108 KB Output is correct
34 Correct 203 ms 564056 KB Output is correct
35 Correct 197 ms 564092 KB Output is correct
36 Correct 201 ms 565332 KB Output is correct
37 Correct 200 ms 565448 KB Output is correct
38 Correct 205 ms 566612 KB Output is correct
39 Correct 204 ms 566100 KB Output is correct
40 Correct 204 ms 565272 KB Output is correct
41 Correct 201 ms 565212 KB Output is correct
42 Correct 200 ms 565588 KB Output is correct
43 Correct 200 ms 565192 KB Output is correct
44 Correct 199 ms 565072 KB Output is correct
45 Correct 207 ms 565964 KB Output is correct
46 Correct 202 ms 565704 KB Output is correct
47 Correct 200 ms 565452 KB Output is correct
48 Correct 205 ms 565176 KB Output is correct
49 Correct 201 ms 565560 KB Output is correct
50 Correct 203 ms 565668 KB Output is correct
51 Correct 205 ms 565652 KB Output is correct
52 Correct 212 ms 565408 KB Output is correct
53 Correct 204 ms 565352 KB Output is correct
54 Correct 206 ms 565092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 197 ms 563828 KB Output is correct
2 Correct 199 ms 563796 KB Output is correct
3 Correct 199 ms 564036 KB Output is correct
4 Correct 197 ms 563844 KB Output is correct
5 Correct 196 ms 564052 KB Output is correct
6 Correct 200 ms 563832 KB Output is correct
7 Correct 197 ms 563792 KB Output is correct
8 Correct 197 ms 564048 KB Output is correct
9 Correct 197 ms 564052 KB Output is correct
10 Correct 200 ms 564080 KB Output is correct
11 Correct 204 ms 564308 KB Output is correct
12 Correct 197 ms 563840 KB Output is correct
13 Correct 195 ms 564048 KB Output is correct
14 Correct 205 ms 564484 KB Output is correct
15 Correct 201 ms 564048 KB Output is correct
16 Correct 198 ms 564304 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 197 ms 563796 KB Output is correct
19 Correct 198 ms 563844 KB Output is correct
20 Correct 200 ms 563844 KB Output is correct
21 Correct 201 ms 563792 KB Output is correct
22 Correct 202 ms 564052 KB Output is correct
23 Correct 197 ms 564040 KB Output is correct
24 Correct 203 ms 564032 KB Output is correct
25 Correct 201 ms 563960 KB Output is correct
26 Correct 200 ms 563796 KB Output is correct
27 Correct 200 ms 564032 KB Output is correct
28 Correct 198 ms 564048 KB Output is correct
29 Correct 199 ms 563980 KB Output is correct
30 Correct 202 ms 564052 KB Output is correct
31 Correct 197 ms 564056 KB Output is correct
32 Correct 196 ms 564076 KB Output is correct
33 Correct 202 ms 565108 KB Output is correct
34 Correct 203 ms 564056 KB Output is correct
35 Correct 197 ms 564092 KB Output is correct
36 Correct 201 ms 565332 KB Output is correct
37 Correct 200 ms 565448 KB Output is correct
38 Correct 205 ms 566612 KB Output is correct
39 Correct 204 ms 566100 KB Output is correct
40 Correct 204 ms 565272 KB Output is correct
41 Correct 201 ms 565212 KB Output is correct
42 Correct 200 ms 565588 KB Output is correct
43 Correct 200 ms 565192 KB Output is correct
44 Correct 199 ms 565072 KB Output is correct
45 Correct 207 ms 565964 KB Output is correct
46 Correct 202 ms 565704 KB Output is correct
47 Correct 200 ms 565452 KB Output is correct
48 Correct 205 ms 565176 KB Output is correct
49 Correct 201 ms 565560 KB Output is correct
50 Correct 203 ms 565668 KB Output is correct
51 Correct 205 ms 565652 KB Output is correct
52 Correct 212 ms 565408 KB Output is correct
53 Correct 204 ms 565352 KB Output is correct
54 Correct 206 ms 565092 KB Output is correct
55 Correct 210 ms 567892 KB Output is correct
56 Correct 202 ms 565448 KB Output is correct
57 Correct 215 ms 570192 KB Output is correct
58 Incorrect 213 ms 567444 KB Output isn't correct
59 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 196 ms 564032 KB Output is correct
2 Correct 198 ms 563812 KB Output is correct
3 Correct 195 ms 564068 KB Output is correct
4 Correct 196 ms 564052 KB Output is correct
5 Correct 198 ms 564076 KB Output is correct
6 Correct 278 ms 564072 KB Output is correct
7 Correct 195 ms 563976 KB Output is correct
8 Correct 203 ms 564300 KB Output is correct
9 Correct 196 ms 563984 KB Output is correct
10 Correct 199 ms 563800 KB Output is correct
11 Correct 202 ms 564308 KB Output is correct
12 Correct 201 ms 563792 KB Output is correct
13 Correct 199 ms 563796 KB Output is correct
14 Correct 202 ms 563792 KB Output is correct
15 Correct 197 ms 563792 KB Output is correct
16 Correct 199 ms 563908 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 198 ms 564052 KB Output is correct
19 Correct 205 ms 565208 KB Output is correct
20 Correct 208 ms 565848 KB Output is correct
21 Correct 212 ms 566124 KB Output is correct
22 Correct 204 ms 565072 KB Output is correct
23 Correct 205 ms 565328 KB Output is correct
24 Correct 199 ms 565708 KB Output is correct
25 Correct 200 ms 565908 KB Output is correct
26 Correct 212 ms 565664 KB Output is correct
27 Correct 208 ms 565328 KB Output is correct
28 Correct 203 ms 565328 KB Output is correct
29 Correct 210 ms 567956 KB Output is correct
30 Correct 202 ms 565400 KB Output is correct
31 Correct 207 ms 571476 KB Output is correct
32 Correct 220 ms 568156 KB Output is correct
33 Correct 217 ms 567964 KB Output is correct
34 Correct 205 ms 568992 KB Output is correct
35 Correct 206 ms 569016 KB Output is correct
36 Correct 217 ms 568144 KB Output is correct
37 Correct 217 ms 568080 KB Output is correct
38 Correct 206 ms 567892 KB Output is correct
39 Correct 351 ms 610132 KB Output is correct
40 Correct 220 ms 568404 KB Output is correct
41 Correct 211 ms 569492 KB Output is correct
42 Correct 220 ms 570848 KB Output is correct
43 Correct 220 ms 570312 KB Output is correct
44 Correct 272 ms 579976 KB Output is correct
45 Correct 267 ms 586084 KB Output is correct
46 Correct 321 ms 641296 KB Output is correct
47 Correct 384 ms 610192 KB Output is correct
48 Correct 367 ms 610340 KB Output is correct
49 Correct 280 ms 609868 KB Output is correct
50 Correct 279 ms 609872 KB Output is correct
51 Correct 391 ms 611156 KB Output is correct
52 Correct 415 ms 610684 KB Output is correct
53 Correct 358 ms 610388 KB Output is correct
54 Correct 197 ms 563828 KB Output is correct
55 Correct 199 ms 563796 KB Output is correct
56 Correct 199 ms 564036 KB Output is correct
57 Correct 197 ms 563844 KB Output is correct
58 Correct 196 ms 564052 KB Output is correct
59 Correct 200 ms 563832 KB Output is correct
60 Correct 197 ms 563792 KB Output is correct
61 Correct 197 ms 564048 KB Output is correct
62 Correct 197 ms 564052 KB Output is correct
63 Correct 200 ms 564080 KB Output is correct
64 Correct 204 ms 564308 KB Output is correct
65 Correct 197 ms 563840 KB Output is correct
66 Correct 195 ms 564048 KB Output is correct
67 Correct 205 ms 564484 KB Output is correct
68 Correct 201 ms 564048 KB Output is correct
69 Correct 198 ms 564304 KB Output is correct
70 Correct 200 ms 564052 KB Output is correct
71 Correct 197 ms 563796 KB Output is correct
72 Correct 198 ms 563844 KB Output is correct
73 Correct 200 ms 563844 KB Output is correct
74 Correct 201 ms 563792 KB Output is correct
75 Correct 202 ms 564052 KB Output is correct
76 Correct 197 ms 564040 KB Output is correct
77 Correct 203 ms 564032 KB Output is correct
78 Correct 201 ms 563960 KB Output is correct
79 Correct 200 ms 563796 KB Output is correct
80 Correct 200 ms 564032 KB Output is correct
81 Correct 198 ms 564048 KB Output is correct
82 Correct 199 ms 563980 KB Output is correct
83 Correct 202 ms 564052 KB Output is correct
84 Correct 197 ms 564056 KB Output is correct
85 Correct 196 ms 564076 KB Output is correct
86 Correct 202 ms 563792 KB Output is correct
87 Correct 201 ms 564052 KB Output is correct
88 Correct 201 ms 563904 KB Output is correct
89 Correct 197 ms 563800 KB Output is correct
90 Correct 201 ms 563796 KB Output is correct
91 Correct 196 ms 563792 KB Output is correct
92 Correct 200 ms 564052 KB Output is correct
93 Correct 208 ms 564304 KB Output is correct
94 Correct 199 ms 563828 KB Output is correct
95 Correct 199 ms 564048 KB Output is correct
96 Correct 203 ms 563936 KB Output is correct
97 Correct 198 ms 564056 KB Output is correct
98 Correct 202 ms 563924 KB Output is correct
99 Correct 201 ms 564304 KB Output is correct
100 Correct 204 ms 563980 KB Output is correct
101 Correct 200 ms 564044 KB Output is correct
102 Correct 199 ms 564052 KB Output is correct
103 Correct 198 ms 563872 KB Output is correct
104 Correct 199 ms 564052 KB Output is correct
105 Correct 199 ms 563796 KB Output is correct
106 Correct 202 ms 564048 KB Output is correct
107 Correct 198 ms 564048 KB Output is correct
108 Correct 203 ms 564312 KB Output is correct
109 Correct 210 ms 564312 KB Output is correct
110 Correct 207 ms 565336 KB Output is correct
111 Correct 205 ms 566784 KB Output is correct
112 Correct 204 ms 566096 KB Output is correct
113 Correct 201 ms 565844 KB Output is correct
114 Correct 199 ms 565072 KB Output is correct
115 Correct 235 ms 565076 KB Output is correct
116 Correct 203 ms 565428 KB Output is correct
117 Correct 246 ms 565332 KB Output is correct
118 Correct 202 ms 565332 KB Output is correct
119 Correct 216 ms 570240 KB Output is correct
120 Correct 210 ms 571528 KB Output is correct
121 Correct 205 ms 568916 KB Output is correct
122 Correct 200 ms 567888 KB Output is correct
123 Correct 198 ms 567888 KB Output is correct
124 Correct 253 ms 584020 KB Output is correct
125 Correct 351 ms 615172 KB Output is correct
126 Correct 324 ms 641256 KB Output is correct
127 Correct 266 ms 617044 KB Output is correct
128 Correct 232 ms 610252 KB Output is correct
129 Correct 233 ms 610252 KB Output is correct
130 Correct 342 ms 623104 KB Output is correct
131 Correct 343 ms 621560 KB Output is correct
132 Correct 202 ms 565108 KB Output is correct
133 Correct 203 ms 564056 KB Output is correct
134 Correct 197 ms 564092 KB Output is correct
135 Correct 201 ms 565332 KB Output is correct
136 Correct 200 ms 565448 KB Output is correct
137 Correct 205 ms 566612 KB Output is correct
138 Correct 204 ms 566100 KB Output is correct
139 Correct 204 ms 565272 KB Output is correct
140 Correct 201 ms 565212 KB Output is correct
141 Correct 200 ms 565588 KB Output is correct
142 Correct 200 ms 565192 KB Output is correct
143 Correct 199 ms 565072 KB Output is correct
144 Correct 207 ms 565964 KB Output is correct
145 Correct 202 ms 565704 KB Output is correct
146 Correct 200 ms 565452 KB Output is correct
147 Correct 205 ms 565176 KB Output is correct
148 Correct 201 ms 565560 KB Output is correct
149 Correct 203 ms 565668 KB Output is correct
150 Correct 205 ms 565652 KB Output is correct
151 Correct 212 ms 565408 KB Output is correct
152 Correct 204 ms 565352 KB Output is correct
153 Correct 206 ms 565092 KB Output is correct
154 Correct 210 ms 567892 KB Output is correct
155 Correct 202 ms 565448 KB Output is correct
156 Correct 215 ms 570192 KB Output is correct
157 Incorrect 213 ms 567444 KB Output isn't correct
158 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 196 ms 564032 KB Output is correct
2 Correct 198 ms 563812 KB Output is correct
3 Correct 195 ms 564068 KB Output is correct
4 Correct 196 ms 564052 KB Output is correct
5 Correct 198 ms 564076 KB Output is correct
6 Correct 278 ms 564072 KB Output is correct
7 Correct 195 ms 563976 KB Output is correct
8 Correct 203 ms 564300 KB Output is correct
9 Correct 196 ms 563984 KB Output is correct
10 Correct 199 ms 563800 KB Output is correct
11 Correct 202 ms 564308 KB Output is correct
12 Correct 201 ms 563792 KB Output is correct
13 Correct 199 ms 563796 KB Output is correct
14 Correct 202 ms 563792 KB Output is correct
15 Correct 197 ms 563792 KB Output is correct
16 Correct 199 ms 563908 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 198 ms 564052 KB Output is correct
19 Correct 205 ms 565208 KB Output is correct
20 Correct 208 ms 565848 KB Output is correct
21 Correct 212 ms 566124 KB Output is correct
22 Correct 204 ms 565072 KB Output is correct
23 Correct 205 ms 565328 KB Output is correct
24 Correct 199 ms 565708 KB Output is correct
25 Correct 200 ms 565908 KB Output is correct
26 Correct 212 ms 565664 KB Output is correct
27 Correct 208 ms 565328 KB Output is correct
28 Correct 203 ms 565328 KB Output is correct
29 Correct 210 ms 567956 KB Output is correct
30 Correct 202 ms 565400 KB Output is correct
31 Correct 207 ms 571476 KB Output is correct
32 Correct 220 ms 568156 KB Output is correct
33 Correct 217 ms 567964 KB Output is correct
34 Correct 205 ms 568992 KB Output is correct
35 Correct 206 ms 569016 KB Output is correct
36 Correct 217 ms 568144 KB Output is correct
37 Correct 217 ms 568080 KB Output is correct
38 Correct 206 ms 567892 KB Output is correct
39 Correct 351 ms 610132 KB Output is correct
40 Correct 220 ms 568404 KB Output is correct
41 Correct 211 ms 569492 KB Output is correct
42 Correct 220 ms 570848 KB Output is correct
43 Correct 220 ms 570312 KB Output is correct
44 Correct 272 ms 579976 KB Output is correct
45 Correct 267 ms 586084 KB Output is correct
46 Correct 321 ms 641296 KB Output is correct
47 Correct 384 ms 610192 KB Output is correct
48 Correct 367 ms 610340 KB Output is correct
49 Correct 280 ms 609868 KB Output is correct
50 Correct 279 ms 609872 KB Output is correct
51 Correct 391 ms 611156 KB Output is correct
52 Correct 415 ms 610684 KB Output is correct
53 Correct 358 ms 610388 KB Output is correct
54 Correct 197 ms 563828 KB Output is correct
55 Correct 199 ms 563796 KB Output is correct
56 Correct 199 ms 564036 KB Output is correct
57 Correct 197 ms 563844 KB Output is correct
58 Correct 196 ms 564052 KB Output is correct
59 Correct 200 ms 563832 KB Output is correct
60 Correct 197 ms 563792 KB Output is correct
61 Correct 197 ms 564048 KB Output is correct
62 Correct 197 ms 564052 KB Output is correct
63 Correct 200 ms 564080 KB Output is correct
64 Correct 204 ms 564308 KB Output is correct
65 Correct 197 ms 563840 KB Output is correct
66 Correct 195 ms 564048 KB Output is correct
67 Correct 205 ms 564484 KB Output is correct
68 Correct 201 ms 564048 KB Output is correct
69 Correct 198 ms 564304 KB Output is correct
70 Correct 200 ms 564052 KB Output is correct
71 Correct 197 ms 563796 KB Output is correct
72 Correct 198 ms 563844 KB Output is correct
73 Correct 200 ms 563844 KB Output is correct
74 Correct 201 ms 563792 KB Output is correct
75 Correct 202 ms 564052 KB Output is correct
76 Correct 197 ms 564040 KB Output is correct
77 Correct 203 ms 564032 KB Output is correct
78 Correct 201 ms 563960 KB Output is correct
79 Correct 200 ms 563796 KB Output is correct
80 Correct 200 ms 564032 KB Output is correct
81 Correct 198 ms 564048 KB Output is correct
82 Correct 199 ms 563980 KB Output is correct
83 Correct 202 ms 564052 KB Output is correct
84 Correct 197 ms 564056 KB Output is correct
85 Correct 196 ms 564076 KB Output is correct
86 Correct 202 ms 563792 KB Output is correct
87 Correct 201 ms 564052 KB Output is correct
88 Correct 201 ms 563904 KB Output is correct
89 Correct 197 ms 563800 KB Output is correct
90 Correct 201 ms 563796 KB Output is correct
91 Correct 196 ms 563792 KB Output is correct
92 Correct 200 ms 564052 KB Output is correct
93 Correct 208 ms 564304 KB Output is correct
94 Correct 199 ms 563828 KB Output is correct
95 Correct 199 ms 564048 KB Output is correct
96 Correct 203 ms 563936 KB Output is correct
97 Correct 198 ms 564056 KB Output is correct
98 Correct 202 ms 563924 KB Output is correct
99 Correct 201 ms 564304 KB Output is correct
100 Correct 204 ms 563980 KB Output is correct
101 Correct 200 ms 564044 KB Output is correct
102 Correct 199 ms 564052 KB Output is correct
103 Correct 198 ms 563872 KB Output is correct
104 Correct 199 ms 564052 KB Output is correct
105 Correct 199 ms 563796 KB Output is correct
106 Correct 202 ms 564048 KB Output is correct
107 Correct 198 ms 564048 KB Output is correct
108 Correct 203 ms 564312 KB Output is correct
109 Correct 210 ms 564312 KB Output is correct
110 Correct 207 ms 565336 KB Output is correct
111 Correct 205 ms 566784 KB Output is correct
112 Correct 204 ms 566096 KB Output is correct
113 Correct 201 ms 565844 KB Output is correct
114 Correct 199 ms 565072 KB Output is correct
115 Correct 235 ms 565076 KB Output is correct
116 Correct 203 ms 565428 KB Output is correct
117 Correct 246 ms 565332 KB Output is correct
118 Correct 202 ms 565332 KB Output is correct
119 Correct 216 ms 570240 KB Output is correct
120 Correct 210 ms 571528 KB Output is correct
121 Correct 205 ms 568916 KB Output is correct
122 Correct 200 ms 567888 KB Output is correct
123 Correct 198 ms 567888 KB Output is correct
124 Correct 253 ms 584020 KB Output is correct
125 Correct 351 ms 615172 KB Output is correct
126 Correct 324 ms 641256 KB Output is correct
127 Correct 266 ms 617044 KB Output is correct
128 Correct 232 ms 610252 KB Output is correct
129 Correct 233 ms 610252 KB Output is correct
130 Correct 342 ms 623104 KB Output is correct
131 Correct 343 ms 621560 KB Output is correct
132 Correct 202 ms 565108 KB Output is correct
133 Correct 203 ms 564056 KB Output is correct
134 Correct 197 ms 564092 KB Output is correct
135 Correct 201 ms 565332 KB Output is correct
136 Correct 200 ms 565448 KB Output is correct
137 Correct 205 ms 566612 KB Output is correct
138 Correct 204 ms 566100 KB Output is correct
139 Correct 204 ms 565272 KB Output is correct
140 Correct 201 ms 565212 KB Output is correct
141 Correct 200 ms 565588 KB Output is correct
142 Correct 200 ms 565192 KB Output is correct
143 Correct 199 ms 565072 KB Output is correct
144 Correct 207 ms 565964 KB Output is correct
145 Correct 202 ms 565704 KB Output is correct
146 Correct 200 ms 565452 KB Output is correct
147 Correct 205 ms 565176 KB Output is correct
148 Correct 201 ms 565560 KB Output is correct
149 Correct 203 ms 565668 KB Output is correct
150 Correct 205 ms 565652 KB Output is correct
151 Correct 212 ms 565408 KB Output is correct
152 Correct 204 ms 565352 KB Output is correct
153 Correct 206 ms 565092 KB Output is correct
154 Correct 210 ms 567892 KB Output is correct
155 Correct 202 ms 565448 KB Output is correct
156 Correct 215 ms 570192 KB Output is correct
157 Incorrect 213 ms 567444 KB Output isn't correct
158 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 196 ms 564032 KB Output is correct
2 Correct 198 ms 563812 KB Output is correct
3 Correct 195 ms 564068 KB Output is correct
4 Correct 196 ms 564052 KB Output is correct
5 Correct 198 ms 564076 KB Output is correct
6 Correct 278 ms 564072 KB Output is correct
7 Correct 195 ms 563976 KB Output is correct
8 Correct 203 ms 564300 KB Output is correct
9 Correct 196 ms 563984 KB Output is correct
10 Correct 199 ms 563800 KB Output is correct
11 Correct 202 ms 564308 KB Output is correct
12 Correct 201 ms 563792 KB Output is correct
13 Correct 199 ms 563796 KB Output is correct
14 Correct 202 ms 563792 KB Output is correct
15 Correct 197 ms 563792 KB Output is correct
16 Correct 199 ms 563908 KB Output is correct
17 Correct 200 ms 564052 KB Output is correct
18 Correct 198 ms 564052 KB Output is correct
19 Correct 205 ms 565208 KB Output is correct
20 Correct 208 ms 565848 KB Output is correct
21 Correct 212 ms 566124 KB Output is correct
22 Correct 204 ms 565072 KB Output is correct
23 Correct 205 ms 565328 KB Output is correct
24 Correct 199 ms 565708 KB Output is correct
25 Correct 200 ms 565908 KB Output is correct
26 Correct 212 ms 565664 KB Output is correct
27 Correct 208 ms 565328 KB Output is correct
28 Correct 203 ms 565328 KB Output is correct
29 Correct 210 ms 567956 KB Output is correct
30 Correct 202 ms 565400 KB Output is correct
31 Correct 207 ms 571476 KB Output is correct
32 Correct 220 ms 568156 KB Output is correct
33 Correct 217 ms 567964 KB Output is correct
34 Correct 205 ms 568992 KB Output is correct
35 Correct 206 ms 569016 KB Output is correct
36 Correct 217 ms 568144 KB Output is correct
37 Correct 217 ms 568080 KB Output is correct
38 Correct 206 ms 567892 KB Output is correct
39 Correct 351 ms 610132 KB Output is correct
40 Correct 220 ms 568404 KB Output is correct
41 Correct 211 ms 569492 KB Output is correct
42 Correct 220 ms 570848 KB Output is correct
43 Correct 220 ms 570312 KB Output is correct
44 Correct 272 ms 579976 KB Output is correct
45 Correct 267 ms 586084 KB Output is correct
46 Correct 321 ms 641296 KB Output is correct
47 Correct 384 ms 610192 KB Output is correct
48 Correct 367 ms 610340 KB Output is correct
49 Correct 280 ms 609868 KB Output is correct
50 Correct 279 ms 609872 KB Output is correct
51 Correct 391 ms 611156 KB Output is correct
52 Correct 415 ms 610684 KB Output is correct
53 Correct 358 ms 610388 KB Output is correct
54 Correct 197 ms 563828 KB Output is correct
55 Correct 199 ms 563796 KB Output is correct
56 Correct 199 ms 564036 KB Output is correct
57 Correct 197 ms 563844 KB Output is correct
58 Correct 196 ms 564052 KB Output is correct
59 Correct 200 ms 563832 KB Output is correct
60 Correct 197 ms 563792 KB Output is correct
61 Correct 197 ms 564048 KB Output is correct
62 Correct 197 ms 564052 KB Output is correct
63 Correct 200 ms 564080 KB Output is correct
64 Correct 204 ms 564308 KB Output is correct
65 Correct 197 ms 563840 KB Output is correct
66 Correct 195 ms 564048 KB Output is correct
67 Correct 205 ms 564484 KB Output is correct
68 Correct 201 ms 564048 KB Output is correct
69 Correct 198 ms 564304 KB Output is correct
70 Correct 200 ms 564052 KB Output is correct
71 Correct 197 ms 563796 KB Output is correct
72 Correct 198 ms 563844 KB Output is correct
73 Correct 200 ms 563844 KB Output is correct
74 Correct 201 ms 563792 KB Output is correct
75 Correct 202 ms 564052 KB Output is correct
76 Correct 197 ms 564040 KB Output is correct
77 Correct 203 ms 564032 KB Output is correct
78 Correct 201 ms 563960 KB Output is correct
79 Correct 200 ms 563796 KB Output is correct
80 Correct 200 ms 564032 KB Output is correct
81 Correct 198 ms 564048 KB Output is correct
82 Correct 199 ms 563980 KB Output is correct
83 Correct 202 ms 564052 KB Output is correct
84 Correct 197 ms 564056 KB Output is correct
85 Correct 196 ms 564076 KB Output is correct
86 Correct 202 ms 563792 KB Output is correct
87 Correct 201 ms 564052 KB Output is correct
88 Correct 201 ms 563904 KB Output is correct
89 Correct 197 ms 563800 KB Output is correct
90 Correct 201 ms 563796 KB Output is correct
91 Correct 196 ms 563792 KB Output is correct
92 Correct 200 ms 564052 KB Output is correct
93 Correct 208 ms 564304 KB Output is correct
94 Correct 199 ms 563828 KB Output is correct
95 Correct 199 ms 564048 KB Output is correct
96 Correct 203 ms 563936 KB Output is correct
97 Correct 198 ms 564056 KB Output is correct
98 Correct 202 ms 563924 KB Output is correct
99 Correct 201 ms 564304 KB Output is correct
100 Correct 204 ms 563980 KB Output is correct
101 Correct 200 ms 564044 KB Output is correct
102 Correct 199 ms 564052 KB Output is correct
103 Correct 198 ms 563872 KB Output is correct
104 Correct 199 ms 564052 KB Output is correct
105 Correct 199 ms 563796 KB Output is correct
106 Correct 202 ms 564048 KB Output is correct
107 Correct 198 ms 564048 KB Output is correct
108 Correct 203 ms 564312 KB Output is correct
109 Correct 210 ms 564312 KB Output is correct
110 Correct 207 ms 565336 KB Output is correct
111 Correct 205 ms 566784 KB Output is correct
112 Correct 204 ms 566096 KB Output is correct
113 Correct 201 ms 565844 KB Output is correct
114 Correct 199 ms 565072 KB Output is correct
115 Correct 235 ms 565076 KB Output is correct
116 Correct 203 ms 565428 KB Output is correct
117 Correct 246 ms 565332 KB Output is correct
118 Correct 202 ms 565332 KB Output is correct
119 Correct 216 ms 570240 KB Output is correct
120 Correct 210 ms 571528 KB Output is correct
121 Correct 205 ms 568916 KB Output is correct
122 Correct 200 ms 567888 KB Output is correct
123 Correct 198 ms 567888 KB Output is correct
124 Correct 253 ms 584020 KB Output is correct
125 Correct 351 ms 615172 KB Output is correct
126 Correct 324 ms 641256 KB Output is correct
127 Correct 266 ms 617044 KB Output is correct
128 Correct 232 ms 610252 KB Output is correct
129 Correct 233 ms 610252 KB Output is correct
130 Correct 342 ms 623104 KB Output is correct
131 Correct 343 ms 621560 KB Output is correct
132 Correct 202 ms 565108 KB Output is correct
133 Correct 203 ms 564056 KB Output is correct
134 Correct 197 ms 564092 KB Output is correct
135 Correct 201 ms 565332 KB Output is correct
136 Correct 200 ms 565448 KB Output is correct
137 Correct 205 ms 566612 KB Output is correct
138 Correct 204 ms 566100 KB Output is correct
139 Correct 204 ms 565272 KB Output is correct
140 Correct 201 ms 565212 KB Output is correct
141 Correct 200 ms 565588 KB Output is correct
142 Correct 200 ms 565192 KB Output is correct
143 Correct 199 ms 565072 KB Output is correct
144 Correct 207 ms 565964 KB Output is correct
145 Correct 202 ms 565704 KB Output is correct
146 Correct 200 ms 565452 KB Output is correct
147 Correct 205 ms 565176 KB Output is correct
148 Correct 201 ms 565560 KB Output is correct
149 Correct 203 ms 565668 KB Output is correct
150 Correct 205 ms 565652 KB Output is correct
151 Correct 212 ms 565408 KB Output is correct
152 Correct 204 ms 565352 KB Output is correct
153 Correct 206 ms 565092 KB Output is correct
154 Correct 210 ms 567892 KB Output is correct
155 Correct 202 ms 565448 KB Output is correct
156 Correct 215 ms 570192 KB Output is correct
157 Incorrect 213 ms 567444 KB Output isn't correct
158 Halted 0 ms 0 KB -