Submission #710840

# Submission time Handle Problem Language Result Execution time Memory
710840 2023-03-15T22:45:39 Z doowey Mars (APIO22_mars) C++17
100 / 100
1389 ms 5416 KB
#include "mars.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
#define fi first
#define se second
#define mp make_pair
 
pair<pii, pii> rect(int i, int j, int k, int n){
    int side = 2 * n + 1 - k * 2;
    int len = (2 * n + 1) / side;
    int rem = (2 * n + 1) % side;
    int i0 = i * len;
    int i1 = len;
    if(i >= side - rem){
        i0 += i - (side - rem);
        i1 = len + 1;
    }
    i1 += i0 - 1;
    int j0 = j * len;
    int j1 = len;
    if(j >= side - rem){
        j0 += j - (side - rem);
        j1 = len + 1;
    }
    j1 += j0 - 1;
    return mp(mp(i0, j0), mp(i1, j1));
    //
    // len, len, len, len ... len
}
 
vector<pii> gen_corner(int nn, int mm, int i0, int j0){
    vector<pii> A;
 
    if(i0 != j0){
        for(int i = 0 ; i < nn; i ++ ){
            for(int j = 0 ; j < mm ; j ++ ){
                if(i == (1 - i0/2) * (nn - 1) || j == (1 - j0/2) * (mm - 1)){
                    A.push_back(mp(i, j));
                }
            }
        }
    }
    else{
        for(int i = nn - 1 ; i >= 0; i -- ){
            for(int j = 0 ; j < mm ; j ++ ){
                if(i == (1 - i0/2) * (nn - 1) || j == (1 - j0/2) * (mm - 1)){
                    A.push_back(mp(i, j));
                }
            }
        }
    }
 
    //sort(A.begin(), A.end());
    return A;
}
 
vector<vector<int>> cmp;
 
int calc(vector<vector<char>> C){
    cmp.clear();
 
    int nn = C.size();
    int mm = C[0].size();
    cmp.resize(nn);
    queue<pii> G;
    pii nd;
    pii nx;
    int res = 0;
    int mark = 0;
    for(int i = 0; i < nn; i ++ ) cmp[i].resize(mm);
    for(int i = 0 ; i < nn; i ++ ){
        for(int j = 0 ; j < mm ; j ++ ){
            if(C[i][j] == '1'){
                G.push(mp(i,j));
                C[i][j]='0';
                res ++ ;
                mark ++ ;
                while(!G.empty()){
                    nd = G.front();
                    cmp[nd.fi][nd.se] = mark;
                    G.pop();
                    for(int di = -1; di <= +1; di ++ ){
                        for(int dj = -1; dj <= + 1; dj ++ ){
                            if(abs(di) + abs(dj) == 1){
                                nx = mp(nd.fi + di, nd.se + dj);
                                if(nx.fi >= 0 && nx.se >= 0 && nx.fi < nn && nx.se < mm){
                                    if(C[nx.fi][nx.se] == '1'){
                                        C[nx.fi][nx.se] = '0';
                                        G.push(nx);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return res;
}
 
string make_number(int res){
    string sha;
    for(int i = 0 ; i < 25; i ++ ){
        if((res & (1 << i))){
            sha.push_back('1');
        }
        else{
            sha.push_back('0');
        }
    }
    while(sha.size() < 100) sha.push_back('0');
    return sha;
}
 
pair<pii, pii> half(int ii, int jj, int n){
    pii ai = mp((ii/2) * n, (jj/2) * n);
    pii bi = ai;
    bi.fi += n - 1 + ii/2;
    bi.se += n - 1 + jj/2;
    return mp(ai, bi);
}
 
vector<vector<pii>> R;
 
pii fin(pii ai){
    if(R[ai.fi][ai.se] == ai){
        return ai;
    }
    return R[ai.fi][ai.se]=fin(R[ai.fi][ai.se]);
}
 
int total;
bool join(pii ai, pii bi){
    if(R[ai.fi][ai.se].fi == -1 || R[bi.fi][bi.se].fi == -1) return false;
    ai=fin(ai);
    bi=fin(bi);
    if(ai==bi) return false;
    R[ai.fi][ai.se]=bi;
    return true;
}
 
string process(vector <vector<string>> a, int i, int j, int k, int n)
{
    if(n == 1){
        vector<vector<char>> C(3);
        for(int i = 0 ; i < 3; i ++ ){
            C[i].resize(3);
            for(int j = 0 ; j < 3; j ++ ){
                C[i][j] = a[i][j][0];
            }
        }
        return make_number(calc(C));
    }
    pair<pii, pii> need = rect(i, j, k + 1, n);
    if((2 * n + 1) - k * 2 == 5){
        if((i == 0 || i == 2) && (j == 0 || j == 2)){
            pii A = mp((i/2) * n, (j/2) * n);
            pii B = A;
            B.fi += n - 1 + i/2;
            B.se += n - 1 + j/2;
            need = mp(A, B);
        }
    }
    pair<pii, pii> has;
    int nn = need.se.fi - need.fi.fi + 1;
    int mm = need.se.se - need.fi.se + 1;
    vector<vector<char>> C(nn);
    for(int i = 0 ; i < nn; i ++ ){
        C[i].resize(mm, '0');
    }
    int idx;
    for(int di = 0 ; di < 3; di ++ ){
        for(int dj = 0 ; dj < 3; dj ++ ){
            has = rect(i + di, j + dj, k, n);
            idx = 0;
            for(int p = has.fi.fi; p <= has.se.fi; p ++ ){
                for(int q = has.fi.se; q <= has.se.se; q ++ ){
                    if(need.fi.fi <= p && p <= need.se.fi && need.fi.se <= q && q <= need.se.se){
                        C[p - need.fi.fi][q - need.fi.se] = a[di][dj][idx];
                    }
                    idx ++ ;
                }
            }
        }
    }
    if(k < n - 2){
        string ret;
        for(auto ii : C){
            for(auto jj : ii){
                ret.push_back(jj);
            }
        }
        while(ret.size() < 100) ret.push_back('0');
        return ret;
    }
    int q;
    if(k == n - 2){
        if((i == 0 || i == 2) && (j == 0 || j == 2)){
            vector<pii> lis = gen_corner(nn, mm, i, j);
            int comp = calc(C);
            string res = make_number(comp);
            int id = 10;
            vector<int> ids;
            for(int p = 0 ;p < lis.size(); p ++ ){
                if(C[lis[p].fi][lis[p].se] == '1'){
                    res[id] = '1';
                    if(p && C[lis[p].fi][lis[p].se] == C[lis[p - 1].fi][lis[p - 1].se]){
                        id ++ ;
                        res[id] = '0';
                        ids.pop_back();
                    }
                    else{
                        q = -1;
                        for(int yo = (int)ids.size() - 1; yo >= 0; yo -- ){
                            if(cmp[lis[ids[yo]].fi][lis[ids[yo]].se] == cmp[lis[p].fi][lis[p].se]){
                                q = yo;
                                break;
                            }
                        }
                        if(q == -1){
                            id ++ ;
                            res[id] = '0';
                        }
                        else{
                            while(ids.size() > q){
                                id ++ ;
                                res[id] = '1';
                                ids.pop_back();
                            }
                            id ++ ;
                            res[id] = '0';
                        }
                    }
                    ids.push_back(p);
                    id ++ ;
                }
                else{
                    id ++ ;
                }
            }
            return res;
        }
        else{
            return a[0][0];
        }
    }
    else{
        total = 0;
        for(int ii = 0 ; ii < 10; ii ++ ){
            for(int p = 0; p <= 2; p += 2){
                for(int q = 0; q <= 2; q += 2){
                    total += (a[p][q][ii] - '0') * (1 << ii);
                }
            }
        }
        int trav;
        pair<pii, pii> oo;
        R.clear();
        R.resize(2 * n + 1);
        pii las;
        for(int ii = 0; ii < 2 * n + 1; ii ++ ){
            R[ii].resize(2 * n + 1, mp(-1, -1));
        }
        for(int p = 0; p <= 2; p += 2 ){
            for(int q = 0; q <= 2; q += 2){
                oo = half(p, q, n);
 
                trav = 10;
                vector<pii> B = gen_corner(oo.se.fi - oo.fi.fi + 1, oo.se.se - oo.fi.se + 1, p, q);
                vector<pii> GG;
                pii las;
                for(int it = 0 ; it < B.size() ;it ++ ){
                    B[it].fi += oo.fi.fi;
                    B[it].se += oo.fi.se;
                    if(a[p][q][trav] == '1'){
                        R[B[it].fi][B[it].se]=B[it];
 
                        trav ++ ;
                        las = mp(-1, -1);
                        while(a[p][q][trav] == '1'){
                            las = GG.back();
                            GG.pop_back();
                            trav ++ ;
                        }
                        if(las.fi == -1 && it > 0 && R[B[it - 1].fi][B[it - 1].se].fi != -1){
                            las = B[it - 1];
                            GG.pop_back();
                        }
                        if(las.fi != -1){
                            join(B[it], las);
                        }
                        GG.push_back(B[it]);
                    }
                    else{
                    }
                    trav ++ ;
                }
            }
        }
 
        for(int ii = 0; ii < 2 * n + 1; ii ++ ){
            for(int jj = 0; jj < 2 * n + 1; jj ++ ){
                if(jj + 1 < 2 * n + 1){
                    if(join(mp(ii, jj), mp(ii, jj + 1))) total -- ;
                }
                if(ii + 1 < 2 * n + 1){
                    if(join(mp(ii, jj), mp(ii + 1, jj))) total -- ;
                }
            }
        }
 
        return make_number(total);
    }
}

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:210:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  210 |             for(int p = 0 ;p < lis.size(); p ++ ){
      |                            ~~^~~~~~~~~~~~
mars.cpp:231:46: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  231 |                             while(ids.size() > q){
      |                                   ~~~~~~~~~~~^~~
mars.cpp:278:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  278 |                 for(int it = 0 ; it < B.size() ;it ++ ){
      |                                  ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
37 Correct 246 ms 3160 KB Output is correct
38 Correct 308 ms 3416 KB Output is correct
39 Correct 307 ms 3428 KB Output is correct
40 Correct 288 ms 3292 KB Output is correct
41 Correct 304 ms 3364 KB Output is correct
42 Correct 299 ms 3356 KB Output is correct
43 Correct 315 ms 3324 KB Output is correct
44 Correct 313 ms 3344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
37 Correct 246 ms 3160 KB Output is correct
38 Correct 308 ms 3416 KB Output is correct
39 Correct 307 ms 3428 KB Output is correct
40 Correct 288 ms 3292 KB Output is correct
41 Correct 304 ms 3364 KB Output is correct
42 Correct 299 ms 3356 KB Output is correct
43 Correct 315 ms 3324 KB Output is correct
44 Correct 313 ms 3344 KB Output is correct
45 Correct 386 ms 3460 KB Output is correct
46 Correct 455 ms 3596 KB Output is correct
47 Correct 450 ms 3768 KB Output is correct
48 Correct 490 ms 3672 KB Output is correct
49 Correct 460 ms 3728 KB Output is correct
50 Correct 465 ms 3604 KB Output is correct
51 Correct 461 ms 3556 KB Output is correct
52 Correct 471 ms 3556 KB Output is correct
53 Correct 478 ms 3768 KB Output is correct
54 Correct 473 ms 3676 KB Output is correct
55 Correct 477 ms 3576 KB Output is correct
56 Correct 457 ms 3700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
37 Correct 246 ms 3160 KB Output is correct
38 Correct 308 ms 3416 KB Output is correct
39 Correct 307 ms 3428 KB Output is correct
40 Correct 288 ms 3292 KB Output is correct
41 Correct 304 ms 3364 KB Output is correct
42 Correct 299 ms 3356 KB Output is correct
43 Correct 315 ms 3324 KB Output is correct
44 Correct 313 ms 3344 KB Output is correct
45 Correct 386 ms 3460 KB Output is correct
46 Correct 455 ms 3596 KB Output is correct
47 Correct 450 ms 3768 KB Output is correct
48 Correct 490 ms 3672 KB Output is correct
49 Correct 460 ms 3728 KB Output is correct
50 Correct 465 ms 3604 KB Output is correct
51 Correct 461 ms 3556 KB Output is correct
52 Correct 471 ms 3556 KB Output is correct
53 Correct 478 ms 3768 KB Output is correct
54 Correct 473 ms 3676 KB Output is correct
55 Correct 477 ms 3576 KB Output is correct
56 Correct 457 ms 3700 KB Output is correct
57 Correct 572 ms 4076 KB Output is correct
58 Correct 708 ms 4244 KB Output is correct
59 Correct 707 ms 4252 KB Output is correct
60 Correct 710 ms 4328 KB Output is correct
61 Correct 724 ms 4232 KB Output is correct
62 Correct 678 ms 4168 KB Output is correct
63 Correct 710 ms 4248 KB Output is correct
64 Correct 708 ms 4308 KB Output is correct
65 Correct 719 ms 4172 KB Output is correct
66 Correct 712 ms 4304 KB Output is correct
67 Correct 720 ms 4128 KB Output is correct
68 Correct 709 ms 4128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
37 Correct 246 ms 3160 KB Output is correct
38 Correct 308 ms 3416 KB Output is correct
39 Correct 307 ms 3428 KB Output is correct
40 Correct 288 ms 3292 KB Output is correct
41 Correct 304 ms 3364 KB Output is correct
42 Correct 299 ms 3356 KB Output is correct
43 Correct 315 ms 3324 KB Output is correct
44 Correct 313 ms 3344 KB Output is correct
45 Correct 386 ms 3460 KB Output is correct
46 Correct 455 ms 3596 KB Output is correct
47 Correct 450 ms 3768 KB Output is correct
48 Correct 490 ms 3672 KB Output is correct
49 Correct 460 ms 3728 KB Output is correct
50 Correct 465 ms 3604 KB Output is correct
51 Correct 461 ms 3556 KB Output is correct
52 Correct 471 ms 3556 KB Output is correct
53 Correct 478 ms 3768 KB Output is correct
54 Correct 473 ms 3676 KB Output is correct
55 Correct 477 ms 3576 KB Output is correct
56 Correct 457 ms 3700 KB Output is correct
57 Correct 572 ms 4076 KB Output is correct
58 Correct 708 ms 4244 KB Output is correct
59 Correct 707 ms 4252 KB Output is correct
60 Correct 710 ms 4328 KB Output is correct
61 Correct 724 ms 4232 KB Output is correct
62 Correct 678 ms 4168 KB Output is correct
63 Correct 710 ms 4248 KB Output is correct
64 Correct 708 ms 4308 KB Output is correct
65 Correct 719 ms 4172 KB Output is correct
66 Correct 712 ms 4304 KB Output is correct
67 Correct 720 ms 4128 KB Output is correct
68 Correct 709 ms 4128 KB Output is correct
69 Correct 876 ms 4252 KB Output is correct
70 Correct 1012 ms 4532 KB Output is correct
71 Correct 1020 ms 4420 KB Output is correct
72 Correct 1040 ms 4536 KB Output is correct
73 Correct 1020 ms 4720 KB Output is correct
74 Correct 1032 ms 4596 KB Output is correct
75 Correct 1004 ms 4636 KB Output is correct
76 Correct 1030 ms 4452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1948 KB Output is correct
2 Correct 8 ms 2052 KB Output is correct
3 Correct 8 ms 1972 KB Output is correct
4 Correct 8 ms 2016 KB Output is correct
5 Correct 8 ms 1984 KB Output is correct
6 Correct 8 ms 1968 KB Output is correct
7 Correct 13 ms 2112 KB Output is correct
8 Correct 16 ms 2152 KB Output is correct
9 Correct 16 ms 2052 KB Output is correct
10 Correct 17 ms 1972 KB Output is correct
11 Correct 17 ms 1872 KB Output is correct
12 Correct 17 ms 1772 KB Output is correct
13 Correct 20 ms 2056 KB Output is correct
14 Correct 28 ms 2376 KB Output is correct
15 Correct 46 ms 2520 KB Output is correct
16 Correct 52 ms 2508 KB Output is correct
17 Correct 43 ms 2536 KB Output is correct
18 Correct 46 ms 2524 KB Output is correct
19 Correct 46 ms 2528 KB Output is correct
20 Correct 43 ms 2664 KB Output is correct
21 Correct 65 ms 2564 KB Output is correct
22 Correct 92 ms 2728 KB Output is correct
23 Correct 93 ms 2764 KB Output is correct
24 Correct 105 ms 2760 KB Output is correct
25 Correct 90 ms 2792 KB Output is correct
26 Correct 94 ms 2708 KB Output is correct
27 Correct 98 ms 2724 KB Output is correct
28 Correct 99 ms 2936 KB Output is correct
29 Correct 128 ms 2784 KB Output is correct
30 Correct 180 ms 3032 KB Output is correct
31 Correct 180 ms 2956 KB Output is correct
32 Correct 173 ms 2952 KB Output is correct
33 Correct 197 ms 3060 KB Output is correct
34 Correct 181 ms 3016 KB Output is correct
35 Correct 166 ms 3044 KB Output is correct
36 Correct 180 ms 2984 KB Output is correct
37 Correct 246 ms 3160 KB Output is correct
38 Correct 308 ms 3416 KB Output is correct
39 Correct 307 ms 3428 KB Output is correct
40 Correct 288 ms 3292 KB Output is correct
41 Correct 304 ms 3364 KB Output is correct
42 Correct 299 ms 3356 KB Output is correct
43 Correct 315 ms 3324 KB Output is correct
44 Correct 313 ms 3344 KB Output is correct
45 Correct 386 ms 3460 KB Output is correct
46 Correct 455 ms 3596 KB Output is correct
47 Correct 450 ms 3768 KB Output is correct
48 Correct 490 ms 3672 KB Output is correct
49 Correct 460 ms 3728 KB Output is correct
50 Correct 465 ms 3604 KB Output is correct
51 Correct 461 ms 3556 KB Output is correct
52 Correct 471 ms 3556 KB Output is correct
53 Correct 478 ms 3768 KB Output is correct
54 Correct 473 ms 3676 KB Output is correct
55 Correct 477 ms 3576 KB Output is correct
56 Correct 457 ms 3700 KB Output is correct
57 Correct 572 ms 4076 KB Output is correct
58 Correct 708 ms 4244 KB Output is correct
59 Correct 707 ms 4252 KB Output is correct
60 Correct 710 ms 4328 KB Output is correct
61 Correct 724 ms 4232 KB Output is correct
62 Correct 678 ms 4168 KB Output is correct
63 Correct 710 ms 4248 KB Output is correct
64 Correct 708 ms 4308 KB Output is correct
65 Correct 719 ms 4172 KB Output is correct
66 Correct 712 ms 4304 KB Output is correct
67 Correct 720 ms 4128 KB Output is correct
68 Correct 709 ms 4128 KB Output is correct
69 Correct 876 ms 4252 KB Output is correct
70 Correct 1012 ms 4532 KB Output is correct
71 Correct 1020 ms 4420 KB Output is correct
72 Correct 1040 ms 4536 KB Output is correct
73 Correct 1020 ms 4720 KB Output is correct
74 Correct 1032 ms 4596 KB Output is correct
75 Correct 1004 ms 4636 KB Output is correct
76 Correct 1030 ms 4452 KB Output is correct
77 Correct 1016 ms 4452 KB Output is correct
78 Correct 1352 ms 5248 KB Output is correct
79 Correct 1386 ms 5068 KB Output is correct
80 Correct 1389 ms 5008 KB Output is correct
81 Correct 1363 ms 5212 KB Output is correct
82 Correct 1358 ms 5356 KB Output is correct
83 Correct 1358 ms 5416 KB Output is correct
84 Correct 1330 ms 5312 KB Output is correct