답안 #935844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
935844 2024-02-29T16:27:42 Z anton Maze (JOI23_ho_t3) C++17
67 / 100
2000 ms 73624 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<200){
            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;
        }
     
     
    }
# 결과 실행 시간 메모리 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 348 KB Output is correct
7 Correct 0 ms 596 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 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 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 2344 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1884 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2692 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 5 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4148 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5176 KB Output is correct
32 Correct 27 ms 4156 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 22 ms 6452 KB Output is correct
35 Correct 20 ms 6452 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 29 ms 4424 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 219 ms 37276 KB Output is correct
40 Correct 13 ms 4700 KB Output is correct
41 Correct 17 ms 7848 KB Output is correct
42 Correct 33 ms 5724 KB Output is correct
43 Correct 30 ms 8360 KB Output is correct
44 Correct 67 ms 20648 KB Output is correct
45 Correct 66 ms 22576 KB Output is correct
46 Correct 116 ms 43416 KB Output is correct
47 Correct 252 ms 37212 KB Output is correct
48 Correct 165 ms 37540 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 117 ms 60372 KB Output is correct
51 Correct 216 ms 38184 KB Output is correct
52 Correct 161 ms 37456 KB Output is correct
53 Correct 182 ms 37208 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 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 344 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 600 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 348 KB Output is correct
28 Correct 0 ms 348 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 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 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 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 468 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 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 1 ms 344 KB Output is correct
25 Correct 3 ms 1368 KB Output is correct
26 Correct 21 ms 3160 KB Output is correct
27 Correct 4 ms 2140 KB Output is correct
28 Correct 8 ms 2648 KB Output is correct
29 Correct 8 ms 3164 KB Output is correct
30 Correct 6 ms 3416 KB Output is correct
31 Correct 39 ms 2032 KB Output is correct
32 Correct 3 ms 1884 KB Output is correct
33 Correct 3 ms 1884 KB Output is correct
34 Correct 185 ms 6668 KB Output is correct
35 Correct 14 ms 5212 KB Output is correct
36 Correct 24 ms 5944 KB Output is correct
37 Correct 22 ms 7732 KB Output is correct
38 Correct 14 ms 7772 KB Output is correct
39 Correct 402 ms 22924 KB Output is correct
40 Correct 330 ms 48724 KB Output is correct
41 Correct 107 ms 43532 KB Output is correct
42 Correct 196 ms 55568 KB Output is correct
43 Correct 215 ms 73624 KB Output is correct
44 Correct 140 ms 73372 KB Output is correct
45 Correct 1076 ms 68784 KB Output is correct
46 Correct 1493 ms 66492 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 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 344 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 600 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 348 KB Output is correct
28 Correct 0 ms 348 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 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 7 ms 1884 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 4 ms 1368 KB Output is correct
37 Correct 5 ms 2284 KB Output is correct
38 Correct 22 ms 3164 KB Output is correct
39 Correct 5 ms 2140 KB Output is correct
40 Correct 10 ms 1884 KB Output is correct
41 Correct 8 ms 1928 KB Output is correct
42 Correct 7 ms 2652 KB Output is correct
43 Correct 8 ms 3164 KB Output is correct
44 Correct 6 ms 3160 KB Output is correct
45 Correct 8 ms 2916 KB Output is correct
46 Correct 6 ms 2692 KB Output is correct
47 Correct 10 ms 2160 KB Output is correct
48 Correct 22 ms 1884 KB Output is correct
49 Correct 29 ms 1976 KB Output is correct
50 Correct 63 ms 1984 KB Output is correct
51 Correct 44 ms 2140 KB Output is correct
52 Correct 4 ms 1884 KB Output is correct
53 Correct 3 ms 1884 KB Output is correct
54 Correct 5 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 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 344 KB Output is correct
16 Correct 1 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 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 600 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 348 KB Output is correct
28 Correct 0 ms 348 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 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 7 ms 1884 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 4 ms 1368 KB Output is correct
37 Correct 5 ms 2284 KB Output is correct
38 Correct 22 ms 3164 KB Output is correct
39 Correct 5 ms 2140 KB Output is correct
40 Correct 10 ms 1884 KB Output is correct
41 Correct 8 ms 1928 KB Output is correct
42 Correct 7 ms 2652 KB Output is correct
43 Correct 8 ms 3164 KB Output is correct
44 Correct 6 ms 3160 KB Output is correct
45 Correct 8 ms 2916 KB Output is correct
46 Correct 6 ms 2692 KB Output is correct
47 Correct 10 ms 2160 KB Output is correct
48 Correct 22 ms 1884 KB Output is correct
49 Correct 29 ms 1976 KB Output is correct
50 Correct 63 ms 1984 KB Output is correct
51 Correct 44 ms 2140 KB Output is correct
52 Correct 4 ms 1884 KB Output is correct
53 Correct 3 ms 1884 KB Output is correct
54 Correct 5 ms 1884 KB Output is correct
55 Correct 22 ms 3932 KB Output is correct
56 Correct 8 ms 2412 KB Output is correct
57 Correct 182 ms 6740 KB Output is correct
58 Correct 34 ms 3932 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 4156 KB Output is correct
62 Correct 19 ms 5976 KB Output is correct
63 Correct 24 ms 7636 KB Output is correct
64 Correct 14 ms 7768 KB Output is correct
65 Correct 22 ms 6444 KB Output is correct
66 Correct 16 ms 6452 KB Output is correct
67 Correct 34 ms 5136 KB Output is correct
68 Correct 89 ms 4188 KB Output is correct
69 Correct 147 ms 4228 KB Output is correct
70 Correct 214 ms 4328 KB Output is correct
71 Correct 303 ms 4636 KB Output is correct
72 Correct 21 ms 4184 KB Output is correct
73 Correct 22 ms 4244 KB Output is correct
74 Correct 7 ms 4152 KB Output is correct
# 결과 실행 시간 메모리 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 348 KB Output is correct
7 Correct 0 ms 596 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 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 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 2344 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1884 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2692 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 5 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4148 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5176 KB Output is correct
32 Correct 27 ms 4156 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 22 ms 6452 KB Output is correct
35 Correct 20 ms 6452 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 29 ms 4424 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 219 ms 37276 KB Output is correct
40 Correct 13 ms 4700 KB Output is correct
41 Correct 17 ms 7848 KB Output is correct
42 Correct 33 ms 5724 KB Output is correct
43 Correct 30 ms 8360 KB Output is correct
44 Correct 67 ms 20648 KB Output is correct
45 Correct 66 ms 22576 KB Output is correct
46 Correct 116 ms 43416 KB Output is correct
47 Correct 252 ms 37212 KB Output is correct
48 Correct 165 ms 37540 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 117 ms 60372 KB Output is correct
51 Correct 216 ms 38184 KB Output is correct
52 Correct 161 ms 37456 KB Output is correct
53 Correct 182 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 1 ms 344 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 344 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 600 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 348 KB Output is correct
81 Correct 0 ms 348 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 344 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 348 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 348 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 1 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 468 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 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 348 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 1 ms 344 KB Output is correct
110 Correct 3 ms 1368 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 4 ms 2140 KB Output is correct
113 Correct 8 ms 2648 KB Output is correct
114 Correct 8 ms 3164 KB Output is correct
115 Correct 6 ms 3416 KB Output is correct
116 Correct 39 ms 2032 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 185 ms 6668 KB Output is correct
120 Correct 14 ms 5212 KB Output is correct
121 Correct 24 ms 5944 KB Output is correct
122 Correct 22 ms 7732 KB Output is correct
123 Correct 14 ms 7772 KB Output is correct
124 Correct 402 ms 22924 KB Output is correct
125 Correct 330 ms 48724 KB Output is correct
126 Correct 107 ms 43532 KB Output is correct
127 Correct 196 ms 55568 KB Output is correct
128 Correct 215 ms 73624 KB Output is correct
129 Correct 140 ms 73372 KB Output is correct
130 Correct 1076 ms 68784 KB Output is correct
131 Correct 1493 ms 66492 KB Output is correct
132 Correct 7 ms 1884 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 4 ms 1368 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 22 ms 3164 KB Output is correct
138 Correct 5 ms 2140 KB Output is correct
139 Correct 10 ms 1884 KB Output is correct
140 Correct 8 ms 1928 KB Output is correct
141 Correct 7 ms 2652 KB Output is correct
142 Correct 8 ms 3164 KB Output is correct
143 Correct 6 ms 3160 KB Output is correct
144 Correct 8 ms 2916 KB Output is correct
145 Correct 6 ms 2692 KB Output is correct
146 Correct 10 ms 2160 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 29 ms 1976 KB Output is correct
149 Correct 63 ms 1984 KB Output is correct
150 Correct 44 ms 2140 KB Output is correct
151 Correct 4 ms 1884 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 22 ms 3932 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 182 ms 6740 KB Output is correct
157 Correct 34 ms 3932 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 4156 KB Output is correct
161 Correct 19 ms 5976 KB Output is correct
162 Correct 24 ms 7636 KB Output is correct
163 Correct 14 ms 7768 KB Output is correct
164 Correct 22 ms 6444 KB Output is correct
165 Correct 16 ms 6452 KB Output is correct
166 Correct 34 ms 5136 KB Output is correct
167 Correct 89 ms 4188 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4328 KB Output is correct
170 Correct 303 ms 4636 KB Output is correct
171 Correct 21 ms 4184 KB Output is correct
172 Correct 22 ms 4244 KB Output is correct
173 Correct 7 ms 4152 KB Output is correct
174 Correct 22 ms 5468 KB Output is correct
175 Correct 489 ms 8824 KB Output is correct
176 Correct 71 ms 23068 KB Output is correct
177 Correct 462 ms 25808 KB Output is correct
178 Correct 108 ms 33148 KB Output is correct
179 Correct 1012 ms 37832 KB Output is correct
180 Execution timed out 2066 ms 37808 KB Time limit exceeded
181 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 348 KB Output is correct
7 Correct 0 ms 596 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 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 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 2344 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1884 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2692 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 5 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4148 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5176 KB Output is correct
32 Correct 27 ms 4156 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 22 ms 6452 KB Output is correct
35 Correct 20 ms 6452 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 29 ms 4424 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 219 ms 37276 KB Output is correct
40 Correct 13 ms 4700 KB Output is correct
41 Correct 17 ms 7848 KB Output is correct
42 Correct 33 ms 5724 KB Output is correct
43 Correct 30 ms 8360 KB Output is correct
44 Correct 67 ms 20648 KB Output is correct
45 Correct 66 ms 22576 KB Output is correct
46 Correct 116 ms 43416 KB Output is correct
47 Correct 252 ms 37212 KB Output is correct
48 Correct 165 ms 37540 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 117 ms 60372 KB Output is correct
51 Correct 216 ms 38184 KB Output is correct
52 Correct 161 ms 37456 KB Output is correct
53 Correct 182 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 1 ms 344 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 344 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 600 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 348 KB Output is correct
81 Correct 0 ms 348 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 344 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 348 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 348 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 1 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 468 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 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 348 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 1 ms 344 KB Output is correct
110 Correct 3 ms 1368 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 4 ms 2140 KB Output is correct
113 Correct 8 ms 2648 KB Output is correct
114 Correct 8 ms 3164 KB Output is correct
115 Correct 6 ms 3416 KB Output is correct
116 Correct 39 ms 2032 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 185 ms 6668 KB Output is correct
120 Correct 14 ms 5212 KB Output is correct
121 Correct 24 ms 5944 KB Output is correct
122 Correct 22 ms 7732 KB Output is correct
123 Correct 14 ms 7772 KB Output is correct
124 Correct 402 ms 22924 KB Output is correct
125 Correct 330 ms 48724 KB Output is correct
126 Correct 107 ms 43532 KB Output is correct
127 Correct 196 ms 55568 KB Output is correct
128 Correct 215 ms 73624 KB Output is correct
129 Correct 140 ms 73372 KB Output is correct
130 Correct 1076 ms 68784 KB Output is correct
131 Correct 1493 ms 66492 KB Output is correct
132 Correct 7 ms 1884 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 4 ms 1368 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 22 ms 3164 KB Output is correct
138 Correct 5 ms 2140 KB Output is correct
139 Correct 10 ms 1884 KB Output is correct
140 Correct 8 ms 1928 KB Output is correct
141 Correct 7 ms 2652 KB Output is correct
142 Correct 8 ms 3164 KB Output is correct
143 Correct 6 ms 3160 KB Output is correct
144 Correct 8 ms 2916 KB Output is correct
145 Correct 6 ms 2692 KB Output is correct
146 Correct 10 ms 2160 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 29 ms 1976 KB Output is correct
149 Correct 63 ms 1984 KB Output is correct
150 Correct 44 ms 2140 KB Output is correct
151 Correct 4 ms 1884 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 22 ms 3932 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 182 ms 6740 KB Output is correct
157 Correct 34 ms 3932 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 4156 KB Output is correct
161 Correct 19 ms 5976 KB Output is correct
162 Correct 24 ms 7636 KB Output is correct
163 Correct 14 ms 7768 KB Output is correct
164 Correct 22 ms 6444 KB Output is correct
165 Correct 16 ms 6452 KB Output is correct
166 Correct 34 ms 5136 KB Output is correct
167 Correct 89 ms 4188 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4328 KB Output is correct
170 Correct 303 ms 4636 KB Output is correct
171 Correct 21 ms 4184 KB Output is correct
172 Correct 22 ms 4244 KB Output is correct
173 Correct 7 ms 4152 KB Output is correct
174 Correct 22 ms 5468 KB Output is correct
175 Correct 489 ms 8824 KB Output is correct
176 Correct 71 ms 23068 KB Output is correct
177 Correct 462 ms 25808 KB Output is correct
178 Correct 108 ms 33148 KB Output is correct
179 Correct 1012 ms 37832 KB Output is correct
180 Execution timed out 2066 ms 37808 KB Time limit exceeded
181 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 348 KB Output is correct
7 Correct 0 ms 596 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 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 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 2344 KB Output is correct
21 Correct 5 ms 2140 KB Output is correct
22 Correct 10 ms 1884 KB Output is correct
23 Correct 8 ms 1884 KB Output is correct
24 Correct 8 ms 2692 KB Output is correct
25 Correct 6 ms 2688 KB Output is correct
26 Correct 3 ms 1884 KB Output is correct
27 Correct 5 ms 1884 KB Output is correct
28 Correct 5 ms 1884 KB Output is correct
29 Correct 21 ms 4148 KB Output is correct
30 Correct 8 ms 2412 KB Output is correct
31 Correct 14 ms 5176 KB Output is correct
32 Correct 27 ms 4156 KB Output is correct
33 Correct 18 ms 3932 KB Output is correct
34 Correct 22 ms 6452 KB Output is correct
35 Correct 20 ms 6452 KB Output is correct
36 Correct 17 ms 4188 KB Output is correct
37 Correct 29 ms 4424 KB Output is correct
38 Correct 7 ms 4188 KB Output is correct
39 Correct 219 ms 37276 KB Output is correct
40 Correct 13 ms 4700 KB Output is correct
41 Correct 17 ms 7848 KB Output is correct
42 Correct 33 ms 5724 KB Output is correct
43 Correct 30 ms 8360 KB Output is correct
44 Correct 67 ms 20648 KB Output is correct
45 Correct 66 ms 22576 KB Output is correct
46 Correct 116 ms 43416 KB Output is correct
47 Correct 252 ms 37212 KB Output is correct
48 Correct 165 ms 37540 KB Output is correct
49 Correct 159 ms 60376 KB Output is correct
50 Correct 117 ms 60372 KB Output is correct
51 Correct 216 ms 38184 KB Output is correct
52 Correct 161 ms 37456 KB Output is correct
53 Correct 182 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 1 ms 344 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 0 ms 344 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 0 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 344 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 600 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 348 KB Output is correct
81 Correct 0 ms 348 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 344 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 348 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 348 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 1 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 468 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 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 348 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 1 ms 344 KB Output is correct
110 Correct 3 ms 1368 KB Output is correct
111 Correct 21 ms 3160 KB Output is correct
112 Correct 4 ms 2140 KB Output is correct
113 Correct 8 ms 2648 KB Output is correct
114 Correct 8 ms 3164 KB Output is correct
115 Correct 6 ms 3416 KB Output is correct
116 Correct 39 ms 2032 KB Output is correct
117 Correct 3 ms 1884 KB Output is correct
118 Correct 3 ms 1884 KB Output is correct
119 Correct 185 ms 6668 KB Output is correct
120 Correct 14 ms 5212 KB Output is correct
121 Correct 24 ms 5944 KB Output is correct
122 Correct 22 ms 7732 KB Output is correct
123 Correct 14 ms 7772 KB Output is correct
124 Correct 402 ms 22924 KB Output is correct
125 Correct 330 ms 48724 KB Output is correct
126 Correct 107 ms 43532 KB Output is correct
127 Correct 196 ms 55568 KB Output is correct
128 Correct 215 ms 73624 KB Output is correct
129 Correct 140 ms 73372 KB Output is correct
130 Correct 1076 ms 68784 KB Output is correct
131 Correct 1493 ms 66492 KB Output is correct
132 Correct 7 ms 1884 KB Output is correct
133 Correct 0 ms 348 KB Output is correct
134 Correct 1 ms 348 KB Output is correct
135 Correct 4 ms 1368 KB Output is correct
136 Correct 5 ms 2284 KB Output is correct
137 Correct 22 ms 3164 KB Output is correct
138 Correct 5 ms 2140 KB Output is correct
139 Correct 10 ms 1884 KB Output is correct
140 Correct 8 ms 1928 KB Output is correct
141 Correct 7 ms 2652 KB Output is correct
142 Correct 8 ms 3164 KB Output is correct
143 Correct 6 ms 3160 KB Output is correct
144 Correct 8 ms 2916 KB Output is correct
145 Correct 6 ms 2692 KB Output is correct
146 Correct 10 ms 2160 KB Output is correct
147 Correct 22 ms 1884 KB Output is correct
148 Correct 29 ms 1976 KB Output is correct
149 Correct 63 ms 1984 KB Output is correct
150 Correct 44 ms 2140 KB Output is correct
151 Correct 4 ms 1884 KB Output is correct
152 Correct 3 ms 1884 KB Output is correct
153 Correct 5 ms 1884 KB Output is correct
154 Correct 22 ms 3932 KB Output is correct
155 Correct 8 ms 2412 KB Output is correct
156 Correct 182 ms 6740 KB Output is correct
157 Correct 34 ms 3932 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 4156 KB Output is correct
161 Correct 19 ms 5976 KB Output is correct
162 Correct 24 ms 7636 KB Output is correct
163 Correct 14 ms 7768 KB Output is correct
164 Correct 22 ms 6444 KB Output is correct
165 Correct 16 ms 6452 KB Output is correct
166 Correct 34 ms 5136 KB Output is correct
167 Correct 89 ms 4188 KB Output is correct
168 Correct 147 ms 4228 KB Output is correct
169 Correct 214 ms 4328 KB Output is correct
170 Correct 303 ms 4636 KB Output is correct
171 Correct 21 ms 4184 KB Output is correct
172 Correct 22 ms 4244 KB Output is correct
173 Correct 7 ms 4152 KB Output is correct
174 Correct 22 ms 5468 KB Output is correct
175 Correct 489 ms 8824 KB Output is correct
176 Correct 71 ms 23068 KB Output is correct
177 Correct 462 ms 25808 KB Output is correct
178 Correct 108 ms 33148 KB Output is correct
179 Correct 1012 ms 37832 KB Output is correct
180 Execution timed out 2066 ms 37808 KB Time limit exceeded
181 Halted 0 ms 0 KB -