Submission #935833

# Submission time Handle Problem Language Result Execution time Memory
935833 2024-02-29T15:48:58 Z anton Maze (JOI23_ho_t3) C++17
67 / 100
2000 ms 73568 KB
#include<bits/stdc++.h>


using namespace std;
#define int long long
#define pii pair<int, int>

int R, C;
int N;

pii debut;
pii fin;

vector<vector<char>> maze;
vector<vector<int>> vis;


vector<vector<int>> oc;
vector<vector<int>> v_s;

pii delta[4] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

bool is_valid(pii pos){
    if(pos.first>=R || pos.first< 0){
        return false;
    }
    if(pos.second>=C || pos.second<0){
        return false;
    }
    return true;
}

vector<pii> get_free(pii pos){
    vector<pii> res;
    for(auto d: delta){
        pii c= {pos.first+d.first, pos.second+d.second};
        if(is_valid(c) && maze[c.first][c.second] != '#'){
            res.push_back(c);
        }
    }
    return res;
}

vector<pii> get_paid(pii pos){
    vector<pii> res;

    
    pii c= fin;
    if(is_valid(c)){
        if(abs(c.first-pos.first)<=N && abs(c.second-pos.second)<=N){
            if(abs(c.first-pos.first)<N || abs(c.second-pos.second)<N){
                res.push_back(c);
            }
        }
    }
    

    for(int i= -N; i<=N; i+=2*N){
        for(int j = -(N-1); j<=N-1; j++){
            pii c = {pos.first+i, pos.second+j};
            if(is_valid(c)){
                res.push_back(c);
            }
        }
    }

    for(int i= -N; i<=N; i+=2*N){
        for(int j = -(N-1); j<=N-1; j++){
            pii c = {pos.first+j, pos.second+i};
            if(is_valid(c)){
                res.push_back(c);
            }
        }
    }
    return res;
}


void display(){
    for(int i = 0; i<R; i++){
        for(int j = 0; j<C; j++){
            if(maze[i][j]=='.'){
                if(vis[i][j]){
                    cout<<'o';
                }
                else{
                    cout<<'.';
                }
            }
            else{
                if(vis[i][j]){
                    cout<<'O';
                }
                else{
                    cout<<'#';
                }
            }
        }
        cout<<endl;
    }
    cout<<endl;
}
int BFS(){
    deque<pair<pii, int>> dq;
    dq.push_back({debut, 0});
    vis[debut.first][debut.second] = 0;

    
    while(dq.size()>0){
        //display();
        auto cur= dq.front();
        dq.pop_front();
        pii cur_pos =cur.first;

        int dist = cur.second;
        if(dist!= vis[cur_pos.first][cur_pos.second]){
            continue;
        }

        //cout<<cur_pos.first<<" "<<cur_pos.second<<" "<<dist<<endl;
        //cout<<dist<<endl;

        if(cur_pos == fin){
            return dist;
        }
        
        for(auto e: get_free(cur_pos)){
            if(vis[e.first][e.second] > dist){
                vis[e.first][e.second] = dist;
                dq.push_front({e, dist});
            }
        }

        for(auto e: get_paid(cur_pos)){
            if(vis[e.first][e.second]>dist+1){
                vis[e.first][e.second] = dist+1;
                dq.push_back({e, dist+1});
            }
        }
    }
    return 1e9;

}
void BFS2(int cur){
    deque<pair<pii, int>> dq;
    for(int i = 0; i<R; i++){
        for(int j = 0; j<C; j++){
            if(vis[i][j]==cur+1){
                dq.push_back({{i, j}, vis[i][j]});
            }
        }
    }

    
    while(dq.size()>0){
        //display();
        auto cur= dq.front();
        dq.pop_front();
        pii cur_pos =cur.first;


        int dist = cur.second;        

        if(dist!= vis[cur_pos.first][cur_pos.second]){
            continue;
        }
        
        for(auto e: get_free(cur_pos)){
            if(vis[e.first][e.second] > dist){
                vis[e.first][e.second] = dist;
                dq.push_front({e, dist});
            }
        }
    }
}


void spread(int cur){
    for(int j = 0; j<C; j++){
        for(int i = 0; i<R; i++){
            v_s[i+1][j] = v_s[i][j] ;
            if(vis[i][j]==cur){
                v_s[i+1][j] ++;
            }
        }
    }

    for(int i = 0; i<R; i++){
        int s= 0;
        for(int j = 0; j<C; j++){
            if(j == 0){
                for(int k = 0; k<=N; k++){
                    //cout<<j+k<<endl;
                    s+= v_s[min(R, i+N+1)][j+k]-v_s[max(i-(N), 0LL)][j+k];
                }
            }

            oc[i][j] = s ;
            for(int di = -N; di<=N; di+=2*N){
                for(int dj = -N; dj<=N; dj+=2*N){
                    if(is_valid({i+di, j+dj})){
                        oc[i][j]-=(v_s[i+di+1][j+dj]-v_s[i+di][j+dj]);
                    }
                }
            }
            if(j-(N)>=0){
                s-=v_s[min(R, i+N+1)][j-(N)]-v_s[max(i-(N), 0LL)][j-(N)];
            }
            if(j+N+1<C){
                s+=v_s[min(R, i+N+1)][j+N+1]-v_s[max(i-(N), 0LL)][j+N+1];
            }
        }
    }

    for(int i = 0; i<R; i++){
        for(int j = 0; j<C; j++){
            if(oc[i][j]>0 && vis[i][j] == 1e9){
                vis[i][j] = cur+1;
            }
        }
    }
    BFS2(cur);
}

signed main(){
    cin>>R>>C;
    cin>>N;

    maze.resize(R, vector<char> (C));
    vis.resize(R, vector<int>(C, 1e9));
    oc.resize(R, vector<int>(C));
    v_s.resize(R+1, vector<int>(C, 0));

    cin>>debut.first>>debut.second;
    debut.first--;
    debut.second--;
    cin>>fin.first>>fin.second;
    fin.first--;
    fin.second--;

    
    for(int i = 0; i<R; i++){
        for(int j = 0; j<C; j++){
            cin>>maze[i][j];
        }
    }

    if(N<500){
        cout<<BFS()<<endl;
    }
    else{
        
        vis[debut.first][debut.second] = 0;
        BFS2(-1);
        int c= 0;
        while(vis[fin.first][fin.second] == 1e9){
            spread(c);
            c++;
        }
        cout<<vis[fin.first][fin.second]<<endl;
    }


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 7 ms 1884 KB Output is correct
20 Correct 5 ms 2348 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1880 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2916 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 3 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4068 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5172 KB Output is correct
32 Correct 27 ms 4144 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 21 ms 6448 KB Output is correct
35 Correct 16 ms 6448 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 23 ms 4260 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 210 ms 37280 KB Output is correct
40 Correct 13 ms 4696 KB Output is correct
41 Correct 16 ms 7676 KB Output is correct
42 Correct 33 ms 5468 KB Output is correct
43 Correct 29 ms 8612 KB Output is correct
44 Correct 66 ms 20648 KB Output is correct
45 Correct 65 ms 22484 KB Output is correct
46 Correct 97 ms 43440 KB Output is correct
47 Correct 255 ms 37208 KB Output is correct
48 Correct 163 ms 37304 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 116 ms 60628 KB Output is correct
51 Correct 213 ms 37968 KB Output is correct
52 Correct 168 ms 37464 KB Output is correct
53 Correct 181 ms 37208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 600 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 3 ms 1372 KB Output is correct
26 Correct 21 ms 3160 KB Output is correct
27 Correct 5 ms 2140 KB Output is correct
28 Correct 59 ms 2456 KB Output is correct
29 Correct 3 ms 1884 KB Output is correct
30 Correct 3 ms 1884 KB Output is correct
31 Correct 39 ms 2092 KB Output is correct
32 Correct 3 ms 1884 KB Output is correct
33 Correct 3 ms 1884 KB Output is correct
34 Correct 181 ms 6736 KB Output is correct
35 Correct 14 ms 5208 KB Output is correct
36 Correct 213 ms 5736 KB Output is correct
37 Correct 7 ms 3932 KB Output is correct
38 Correct 6 ms 3932 KB Output is correct
39 Correct 404 ms 22932 KB Output is correct
40 Correct 333 ms 49012 KB Output is correct
41 Correct 96 ms 43416 KB Output is correct
42 Correct 187 ms 55312 KB Output is correct
43 Correct 214 ms 73568 KB Output is correct
44 Correct 144 ms 73524 KB Output is correct
45 Correct 1094 ms 69056 KB Output is correct
46 Correct 1489 ms 66364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 600 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 7 ms 1880 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 3 ms 1396 KB Output is correct
37 Correct 5 ms 2284 KB Output is correct
38 Correct 21 ms 3164 KB Output is correct
39 Correct 4 ms 2140 KB Output is correct
40 Correct 10 ms 1932 KB Output is correct
41 Correct 8 ms 1884 KB Output is correct
42 Correct 58 ms 2432 KB Output is correct
43 Correct 3 ms 1880 KB Output is correct
44 Correct 3 ms 1884 KB Output is correct
45 Correct 8 ms 2912 KB Output is correct
46 Correct 6 ms 2772 KB Output is correct
47 Correct 11 ms 2412 KB Output is correct
48 Correct 22 ms 1884 KB Output is correct
49 Correct 27 ms 1884 KB Output is correct
50 Correct 62 ms 1880 KB Output is correct
51 Correct 40 ms 1880 KB Output is correct
52 Correct 4 ms 1880 KB Output is correct
53 Correct 3 ms 1884 KB Output is correct
54 Correct 5 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 600 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 7 ms 1880 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 3 ms 1396 KB Output is correct
37 Correct 5 ms 2284 KB Output is correct
38 Correct 21 ms 3164 KB Output is correct
39 Correct 4 ms 2140 KB Output is correct
40 Correct 10 ms 1932 KB Output is correct
41 Correct 8 ms 1884 KB Output is correct
42 Correct 58 ms 2432 KB Output is correct
43 Correct 3 ms 1880 KB Output is correct
44 Correct 3 ms 1884 KB Output is correct
45 Correct 8 ms 2912 KB Output is correct
46 Correct 6 ms 2772 KB Output is correct
47 Correct 11 ms 2412 KB Output is correct
48 Correct 22 ms 1884 KB Output is correct
49 Correct 27 ms 1884 KB Output is correct
50 Correct 62 ms 1880 KB Output is correct
51 Correct 40 ms 1880 KB Output is correct
52 Correct 4 ms 1880 KB Output is correct
53 Correct 3 ms 1884 KB Output is correct
54 Correct 5 ms 1884 KB Output is correct
55 Correct 20 ms 3928 KB Output is correct
56 Correct 8 ms 2412 KB Output is correct
57 Correct 181 ms 6740 KB Output is correct
58 Correct 36 ms 3808 KB Output is correct
59 Correct 14 ms 5208 KB Output is correct
60 Correct 26 ms 4188 KB Output is correct
61 Correct 18 ms 3928 KB Output is correct
62 Correct 212 ms 5972 KB Output is correct
63 Correct 8 ms 3928 KB Output is correct
64 Correct 6 ms 3932 KB Output is correct
65 Correct 22 ms 6452 KB Output is correct
66 Correct 20 ms 6452 KB Output is correct
67 Correct 29 ms 5132 KB Output is correct
68 Correct 95 ms 4192 KB Output is correct
69 Correct 147 ms 4228 KB Output is correct
70 Correct 214 ms 4184 KB Output is correct
71 Correct 269 ms 4688 KB Output is correct
72 Correct 17 ms 4188 KB Output is correct
73 Correct 23 ms 4188 KB Output is correct
74 Correct 7 ms 4188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 7 ms 1884 KB Output is correct
20 Correct 5 ms 2348 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1880 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2916 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 3 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4068 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5172 KB Output is correct
32 Correct 27 ms 4144 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 21 ms 6448 KB Output is correct
35 Correct 16 ms 6448 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 23 ms 4260 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 210 ms 37280 KB Output is correct
40 Correct 13 ms 4696 KB Output is correct
41 Correct 16 ms 7676 KB Output is correct
42 Correct 33 ms 5468 KB Output is correct
43 Correct 29 ms 8612 KB Output is correct
44 Correct 66 ms 20648 KB Output is correct
45 Correct 65 ms 22484 KB Output is correct
46 Correct 97 ms 43440 KB Output is correct
47 Correct 255 ms 37208 KB Output is correct
48 Correct 163 ms 37304 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 116 ms 60628 KB Output is correct
51 Correct 213 ms 37968 KB Output is correct
52 Correct 168 ms 37464 KB Output is correct
53 Correct 181 ms 37208 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 344 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 600 KB Output is correct
81 Correct 0 ms 344 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 0 ms 348 KB Output is correct
110 Correct 3 ms 1372 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 5 ms 2140 KB Output is correct
113 Correct 59 ms 2456 KB Output is correct
114 Correct 3 ms 1884 KB Output is correct
115 Correct 3 ms 1884 KB Output is correct
116 Correct 39 ms 2092 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 181 ms 6736 KB Output is correct
120 Correct 14 ms 5208 KB Output is correct
121 Correct 213 ms 5736 KB Output is correct
122 Correct 7 ms 3932 KB Output is correct
123 Correct 6 ms 3932 KB Output is correct
124 Correct 404 ms 22932 KB Output is correct
125 Correct 333 ms 49012 KB Output is correct
126 Correct 96 ms 43416 KB Output is correct
127 Correct 187 ms 55312 KB Output is correct
128 Correct 214 ms 73568 KB Output is correct
129 Correct 144 ms 73524 KB Output is correct
130 Correct 1094 ms 69056 KB Output is correct
131 Correct 1489 ms 66364 KB Output is correct
132 Correct 7 ms 1880 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 3 ms 1396 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 21 ms 3164 KB Output is correct
138 Correct 4 ms 2140 KB Output is correct
139 Correct 10 ms 1932 KB Output is correct
140 Correct 8 ms 1884 KB Output is correct
141 Correct 58 ms 2432 KB Output is correct
142 Correct 3 ms 1880 KB Output is correct
143 Correct 3 ms 1884 KB Output is correct
144 Correct 8 ms 2912 KB Output is correct
145 Correct 6 ms 2772 KB Output is correct
146 Correct 11 ms 2412 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 27 ms 1884 KB Output is correct
149 Correct 62 ms 1880 KB Output is correct
150 Correct 40 ms 1880 KB Output is correct
151 Correct 4 ms 1880 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 20 ms 3928 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 181 ms 6740 KB Output is correct
157 Correct 36 ms 3808 KB Output is correct
158 Correct 14 ms 5208 KB Output is correct
159 Correct 26 ms 4188 KB Output is correct
160 Correct 18 ms 3928 KB Output is correct
161 Correct 212 ms 5972 KB Output is correct
162 Correct 8 ms 3928 KB Output is correct
163 Correct 6 ms 3932 KB Output is correct
164 Correct 22 ms 6452 KB Output is correct
165 Correct 20 ms 6452 KB Output is correct
166 Correct 29 ms 5132 KB Output is correct
167 Correct 95 ms 4192 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4184 KB Output is correct
170 Correct 269 ms 4688 KB Output is correct
171 Correct 17 ms 4188 KB Output is correct
172 Correct 23 ms 4188 KB Output is correct
173 Correct 7 ms 4188 KB Output is correct
174 Correct 25 ms 5724 KB Output is correct
175 Correct 483 ms 9152 KB Output is correct
176 Correct 71 ms 23708 KB Output is correct
177 Correct 462 ms 26548 KB Output is correct
178 Correct 114 ms 34624 KB Output is correct
179 Correct 998 ms 39496 KB Output is correct
180 Execution timed out 2032 ms 39340 KB Time limit exceeded
181 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 7 ms 1884 KB Output is correct
20 Correct 5 ms 2348 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1880 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2916 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 3 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4068 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5172 KB Output is correct
32 Correct 27 ms 4144 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 21 ms 6448 KB Output is correct
35 Correct 16 ms 6448 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 23 ms 4260 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 210 ms 37280 KB Output is correct
40 Correct 13 ms 4696 KB Output is correct
41 Correct 16 ms 7676 KB Output is correct
42 Correct 33 ms 5468 KB Output is correct
43 Correct 29 ms 8612 KB Output is correct
44 Correct 66 ms 20648 KB Output is correct
45 Correct 65 ms 22484 KB Output is correct
46 Correct 97 ms 43440 KB Output is correct
47 Correct 255 ms 37208 KB Output is correct
48 Correct 163 ms 37304 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 116 ms 60628 KB Output is correct
51 Correct 213 ms 37968 KB Output is correct
52 Correct 168 ms 37464 KB Output is correct
53 Correct 181 ms 37208 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 344 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 600 KB Output is correct
81 Correct 0 ms 344 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 0 ms 348 KB Output is correct
110 Correct 3 ms 1372 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 5 ms 2140 KB Output is correct
113 Correct 59 ms 2456 KB Output is correct
114 Correct 3 ms 1884 KB Output is correct
115 Correct 3 ms 1884 KB Output is correct
116 Correct 39 ms 2092 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 181 ms 6736 KB Output is correct
120 Correct 14 ms 5208 KB Output is correct
121 Correct 213 ms 5736 KB Output is correct
122 Correct 7 ms 3932 KB Output is correct
123 Correct 6 ms 3932 KB Output is correct
124 Correct 404 ms 22932 KB Output is correct
125 Correct 333 ms 49012 KB Output is correct
126 Correct 96 ms 43416 KB Output is correct
127 Correct 187 ms 55312 KB Output is correct
128 Correct 214 ms 73568 KB Output is correct
129 Correct 144 ms 73524 KB Output is correct
130 Correct 1094 ms 69056 KB Output is correct
131 Correct 1489 ms 66364 KB Output is correct
132 Correct 7 ms 1880 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 3 ms 1396 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 21 ms 3164 KB Output is correct
138 Correct 4 ms 2140 KB Output is correct
139 Correct 10 ms 1932 KB Output is correct
140 Correct 8 ms 1884 KB Output is correct
141 Correct 58 ms 2432 KB Output is correct
142 Correct 3 ms 1880 KB Output is correct
143 Correct 3 ms 1884 KB Output is correct
144 Correct 8 ms 2912 KB Output is correct
145 Correct 6 ms 2772 KB Output is correct
146 Correct 11 ms 2412 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 27 ms 1884 KB Output is correct
149 Correct 62 ms 1880 KB Output is correct
150 Correct 40 ms 1880 KB Output is correct
151 Correct 4 ms 1880 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 20 ms 3928 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 181 ms 6740 KB Output is correct
157 Correct 36 ms 3808 KB Output is correct
158 Correct 14 ms 5208 KB Output is correct
159 Correct 26 ms 4188 KB Output is correct
160 Correct 18 ms 3928 KB Output is correct
161 Correct 212 ms 5972 KB Output is correct
162 Correct 8 ms 3928 KB Output is correct
163 Correct 6 ms 3932 KB Output is correct
164 Correct 22 ms 6452 KB Output is correct
165 Correct 20 ms 6452 KB Output is correct
166 Correct 29 ms 5132 KB Output is correct
167 Correct 95 ms 4192 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4184 KB Output is correct
170 Correct 269 ms 4688 KB Output is correct
171 Correct 17 ms 4188 KB Output is correct
172 Correct 23 ms 4188 KB Output is correct
173 Correct 7 ms 4188 KB Output is correct
174 Correct 25 ms 5724 KB Output is correct
175 Correct 483 ms 9152 KB Output is correct
176 Correct 71 ms 23708 KB Output is correct
177 Correct 462 ms 26548 KB Output is correct
178 Correct 114 ms 34624 KB Output is correct
179 Correct 998 ms 39496 KB Output is correct
180 Execution timed out 2032 ms 39340 KB Time limit exceeded
181 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 7 ms 1884 KB Output is correct
20 Correct 5 ms 2348 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1880 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2916 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 3 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4068 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5172 KB Output is correct
32 Correct 27 ms 4144 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 21 ms 6448 KB Output is correct
35 Correct 16 ms 6448 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 23 ms 4260 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 210 ms 37280 KB Output is correct
40 Correct 13 ms 4696 KB Output is correct
41 Correct 16 ms 7676 KB Output is correct
42 Correct 33 ms 5468 KB Output is correct
43 Correct 29 ms 8612 KB Output is correct
44 Correct 66 ms 20648 KB Output is correct
45 Correct 65 ms 22484 KB Output is correct
46 Correct 97 ms 43440 KB Output is correct
47 Correct 255 ms 37208 KB Output is correct
48 Correct 163 ms 37304 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 116 ms 60628 KB Output is correct
51 Correct 213 ms 37968 KB Output is correct
52 Correct 168 ms 37464 KB Output is correct
53 Correct 181 ms 37208 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 344 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 600 KB Output is correct
81 Correct 0 ms 344 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 344 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 0 ms 348 KB Output is correct
109 Correct 0 ms 348 KB Output is correct
110 Correct 3 ms 1372 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 5 ms 2140 KB Output is correct
113 Correct 59 ms 2456 KB Output is correct
114 Correct 3 ms 1884 KB Output is correct
115 Correct 3 ms 1884 KB Output is correct
116 Correct 39 ms 2092 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 181 ms 6736 KB Output is correct
120 Correct 14 ms 5208 KB Output is correct
121 Correct 213 ms 5736 KB Output is correct
122 Correct 7 ms 3932 KB Output is correct
123 Correct 6 ms 3932 KB Output is correct
124 Correct 404 ms 22932 KB Output is correct
125 Correct 333 ms 49012 KB Output is correct
126 Correct 96 ms 43416 KB Output is correct
127 Correct 187 ms 55312 KB Output is correct
128 Correct 214 ms 73568 KB Output is correct
129 Correct 144 ms 73524 KB Output is correct
130 Correct 1094 ms 69056 KB Output is correct
131 Correct 1489 ms 66364 KB Output is correct
132 Correct 7 ms 1880 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 3 ms 1396 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 21 ms 3164 KB Output is correct
138 Correct 4 ms 2140 KB Output is correct
139 Correct 10 ms 1932 KB Output is correct
140 Correct 8 ms 1884 KB Output is correct
141 Correct 58 ms 2432 KB Output is correct
142 Correct 3 ms 1880 KB Output is correct
143 Correct 3 ms 1884 KB Output is correct
144 Correct 8 ms 2912 KB Output is correct
145 Correct 6 ms 2772 KB Output is correct
146 Correct 11 ms 2412 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 27 ms 1884 KB Output is correct
149 Correct 62 ms 1880 KB Output is correct
150 Correct 40 ms 1880 KB Output is correct
151 Correct 4 ms 1880 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 20 ms 3928 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 181 ms 6740 KB Output is correct
157 Correct 36 ms 3808 KB Output is correct
158 Correct 14 ms 5208 KB Output is correct
159 Correct 26 ms 4188 KB Output is correct
160 Correct 18 ms 3928 KB Output is correct
161 Correct 212 ms 5972 KB Output is correct
162 Correct 8 ms 3928 KB Output is correct
163 Correct 6 ms 3932 KB Output is correct
164 Correct 22 ms 6452 KB Output is correct
165 Correct 20 ms 6452 KB Output is correct
166 Correct 29 ms 5132 KB Output is correct
167 Correct 95 ms 4192 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4184 KB Output is correct
170 Correct 269 ms 4688 KB Output is correct
171 Correct 17 ms 4188 KB Output is correct
172 Correct 23 ms 4188 KB Output is correct
173 Correct 7 ms 4188 KB Output is correct
174 Correct 25 ms 5724 KB Output is correct
175 Correct 483 ms 9152 KB Output is correct
176 Correct 71 ms 23708 KB Output is correct
177 Correct 462 ms 26548 KB Output is correct
178 Correct 114 ms 34624 KB Output is correct
179 Correct 998 ms 39496 KB Output is correct
180 Execution timed out 2032 ms 39340 KB Time limit exceeded
181 Halted 0 ms 0 KB -