Submission #936670

# Submission time Handle Problem Language Result Execution time Memory
936670 2024-03-02T13:21:51 Z maomao90 Mars (APIO22_mars) C++17
100 / 100
958 ms 7080 KB
// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h> 
#include "mars.h"
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;

#ifndef DEBUG
#define cerr if (0) cerr
#endif

const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 200005;
const int dirr[] = {1, 0, -1, 0}, dirc[] = {0, 1, 0, -1};
const ii corners[] = {{0, 0}, {0, 2}, {2, 2}, {2, 0}};

string process(vector<vector<string>> a, int i, int j, int k, int n) {
    if (n <= 6) {
        int tn = 3 + 2 * k;
        vector<string> grid(tn, string(tn, '0'));
        REP (x, 0, 3) {
            REP (y, 0, 3) {
                REP (p, 0, (k + 1) * (k + 1)) {
                    int r = x + 2 * (p / (k + 1)),
                        c = y + 2 * (p % (k + 1));
                    grid[r][c] = a[x][y][p];
                }
            }
        }
        //cerr << i << ' ' << j << ' ' << k << '\n';
        //REP (r, 0, tn) {
        //cerr << grid[r] << '\n';
        //}
        if (k == n - 1) {
            vector<vector<bool>> vis(tn, vector<bool>(tn, 0));
            int comp = 0;
            REP (r, 0, tn) {
                REP (c, 0, tn) {
                    if (vis[r][c] || grid[r][c] == '0') {
                        continue;
                    }
                    comp++;
                    queue<ii> bfs;
                    bfs.push({r, c});
                    vis[r][c] = 1;
                    while (!bfs.empty()) {
                        auto [ur, uc] = bfs.front(); bfs.pop();
                        REP (k, 0, 4) {
                            int vr = ur + dirr[k], vc = uc + dirc[k];
                            if (vr < 0 || vr >= tn || vc < 0 || vc >= tn) {
                                continue;
                            }
                            if (grid[vr][vc] == '0' || vis[vr][vc]) {
                                continue;
                            }
                            bfs.push({vr, vc});
                            vis[vr][vc] = 1;
                        }
                    }
                }
            }
            string res(100, '0');
            REP (k, 0, 30) {
                if (comp >> k & 1) {
                    res[k] = '1';
                }
            }
            return res;
        }
        string res;
        for (int r = 0; r < tn; r += 2) {
            for (int c = 0; c < tn; c += 2) {
                res += grid[r][c];
            }
        }
        res.resize(100, '0');
        return res;
    }
    int tn = 3 + 2 * k, m = 2 * (n - k - 1);
    int HALFN = (n + 1) / 2 * 2 + 1;
    int BORDER = 2 * n - HALFN + 1;
    int SIDES[] = {BORDER, BORDER, HALFN, HALFN};
    // 3 + 2 * k == HALFN
    // k = (HALFN - 3) / 2
    if (tn <= HALFN) {
        vector<string> grid(tn, string(tn, '0'));
        REP (x, 0, 3) {
            REP (y, 0, 3) {
                REP (p, 0, (k + 1) * (k + 1)) {
                    int r = x + 2 * (p / (k + 1)),
                        c = y + 2 * (p % (k + 1));
                    grid[r][c] = a[x][y][p];
                }
            }
        }
        //cerr << i << ' ' << j << ' ' << k << '\n';
        //REP (r, 0, tn) {
            //cerr << grid[r] << '\n';
        //}
        string res;
        if (tn == HALFN) {
            if (m - 1 <= i && m - 2 <= j) {
                // m - 1 <= r <= 2 * n
                // 2 * n - HALFN + 1 <= r <= 2 * n
                // m - 2 <= c <= 2 * n
                //for (int r = 2 * n - (m - i); r >= i; r -= 2) {
                    //for (int c = 2 * n - (m - j); c >= j; c -= 3) {
                for (int r = 2 * n - (m - i); r >= BORDER; r -= 2) {
                    for (int c = 2 * n - (m - j); c >= BORDER; c -= 3) {
                        res += grid[r - i][c - j];
                    }
                }
            } else if (i < 2 && j < 3) {
                //for (int r = i; r < i + tn; r += 2) {
                    //for (int c = j; c < j + tn; c += 3) {
                for (int r = i; r < BORDER; r += 2) {
                    for (int c = j; c < BORDER; c += 3) {
                        res += grid[r - i][c - j];
                    }
                }
            } else if (i < 3 && m - 1 <= j) {
                //for (int r = i; r < i + tn; r += 3) {
                for (int r = i; r < BORDER; r += 3) {
                    //for (int c = 2 * n - (m - j); c >= j; c -= 2) {
                    for (int c = 2 * n - (m - j); c >= BORDER; c -= 2) {
                        res += grid[r - i][c - j];
                    }
                }
            } else if (m - 2 <= i && j < 2) {
                //for (int r = 2 * n - (m - i); r >= i; r -= 3) {
                for (int r = 2 * n - (m - i); r >= BORDER; r -= 3) {
                    //for (int c = j; c < j + tn; c += 2) {
                    for (int c = j; c < BORDER; c += 2) {
                        res += grid[r - i][c - j];
                    }
                }
            }
        }
        for (int r = 0; r < tn; r += 2) {
            for (int c = 0; c < tn; c += 2) {
                res += grid[r][c];
            }
        }
        res.resize(100, '0');
        return res;
    } else if (k < n - 2) {
        if (m - 1 <= i && m - 2 <= j) {
            return a[2][2];
        } else if (i < 2 && j < 3) {
            return a[0][0];
        } else if (i < 3 && m - 1 <= j) {
            return a[0][2];
        } else if (m - 2 <= i && j < 2) {
            return a[2][0];
        } else {
            return string(100, '0');
        }
    } else if (k == n - 2) {
        vector<string> grid;
        if (i == 2 && j == 2) {
            grid = vector<string>(HALFN, string(HALFN, '0'));
            REP (di, 1, 3) {
                REP (dj, 0, 3) {
                    int ptr = 0;
                    for (int r = 2 * n - (2 - di); r >= BORDER; r -= 2) {
                        for (int c = 2 * n - (2 - dj); c >= BORDER; c -= 3) {
                            grid[r - BORDER][c - BORDER] = a[di][dj][ptr++];
                        }
                    }
                }
            }
        } else if (i == 0 && j == 0) {
            grid = vector<string>(BORDER, string(BORDER, '0'));
            REP (di, 0, 2) {
                REP (dj, 0, 3) {
                    int ptr = 0;
                    for (int r = di; r < BORDER; r += 2) {
                        for (int c = dj; c < BORDER; c += 3) {
                            grid[r][c] = a[di][dj][ptr++];
                        }
                    }
                }
            }
        } else if (i == 0 && j == 2) {
            grid = vector<string>(BORDER, string(HALFN, '0'));
            REP (di, 0, 3) {
                REP (dj, 1, 3) {
                    int ptr = 0;
                    for (int r = di; r < BORDER; r += 3) {
                        for (int c = 2 * n - (2 - dj); c >= BORDER; c -= 2) {
                            grid[r][c - BORDER] = a[di][dj][ptr++];
                        }
                    }
                }
            }
        } else if (i == 2 && j == 0) {
            grid = vector<string>(HALFN, string(BORDER, '0'));
            REP (di, 0, 3) {
                REP (dj, 0, 2) {
                    int ptr = 0;
                    for (int r = 2 * n - (2 - di); r >= BORDER; r -= 3) {
                        for (int c = dj; c < BORDER; c += 2) {
                            grid[r - BORDER][c] = a[di][dj][ptr++];
                        }
                    }
                }
            }
        } else {
            return string(100, '0');
        }
        cerr << i << ' ' << j << '\n';
        REP (i, 0, SZ(grid)) {
            cerr << grid[i] << '\n';
        }
        vector<vi> vis(SZ(grid), vi(SZ(grid[0]), 0));
        int comp = 0, ptr = 1;
        REP (r, 0, SZ(grid)) {
            REP (c, 0, SZ(grid[0])) {
                if (vis[r][c] || grid[r][c] == '0') {
                    continue;
                }
                comp++;
                queue<ii> bfs;
                bfs.push({r, c});
                vis[r][c] = ptr++;
                while (!bfs.empty()) {
                    auto [ur, uc] = bfs.front(); bfs.pop();
                    REP (k, 0, 4) {
                        int vr = ur + dirr[k], vc = uc + dirc[k];
                        if (vr < 0 || vr >= SZ(grid) || vc < 0 || vc >= SZ(grid[0])) {
                            continue;
                        }
                        if (grid[vr][vc] == '0' || vis[vr][vc]) {
                            continue;
                        }
                        bfs.push({vr, vc});
                        vis[vr][vc] = vis[ur][uc];
                    }
                }
            }
        }
        vi border;
        // clockwise
        if (i == 2 && j == 2) {
            // left then down
            RREP (c, SZ(grid[0]) - 1, 0) {
                border.pb(vis[0][c]);
            }
            REP (r, 1, SZ(grid)) {
                border.pb(vis[r][0]);
            }
        } else if (i == 0 && j == 0) {
            // right then up
            REP (c, 0, SZ(grid[0])) {
                border.pb(vis[SZ(grid) - 1][c]);
            }
            RREP (r, SZ(grid) - 2, 0) {
                border.pb(vis[r][SZ(grid[0]) - 1]);
            }
        } else if (i == 0 && j == 2) {
            // down then right
            REP (r, 0, SZ(grid)) {
                border.pb(vis[r][0]);
            }
            REP (c, 1, SZ(grid[1])) {
                border.pb(vis[SZ(grid) - 1][c]);
            }
        } else if (i == 2 && j == 0) {
            // up then left
            RREP (r, SZ(grid) - 1, 0) {
                border.pb(vis[r][SZ(grid[0]) - 1]);
            }
            RREP (c, SZ(grid[0]) - 2, 0) {
                border.pb(vis[0][c]);
            }
        }
        for (int i : border) {
            cerr << i << ' ';
        }
        cerr << '\n';
        vi lst(ptr, -1);
        REP (i, 0, SZ(border)) {
            lst[border[i]] = i;
        }
        REP (i, 1, ptr) {
            comp -= lst[i] != -1;
        }
        string res;
        REP (k, 0, 9) {
            if (comp >> k & 1) {
                res += "1";
            } else {
                res += "0";
            }
        }
        vi stk;
        stk.pb(0);
        int lvl = 0;
        REP (i, 0, SZ(border)) {
            int delta;
            if (border[i] == 0) {
                if (lvl & 1) {
                    if (lst[border[i - 1]] == i - 1) {
                        stk.pop_back();
                        delta = -1;
                    } else {
                        delta = 1;
                    }
                } else {
                    delta = 0;
                }
            } else {
                if (lvl & 1) {
                    delta = 0;
                } else {
                    if (stk.back() != border[i]) {
                        stk.pb(border[i]);
                        delta = 1;
                    } else {
                        delta = -1;
                    }
                }
            }
            if (delta == 0) {
                cerr << '_';
                res += "10";
            } else if (delta == -1) {
                cerr << ')';
                res += "00";
            } else {
                cerr << '(';
                res += "01";
            }
            lvl += delta;
        }
        cerr << '\n';
        res.resize(100, '0');
        cerr << comp << '\n';
        cerr << res << '\n';
        return res;
    } else {
        assert(k == n - 1);
        int ans = 0;
        int ptr = 1;
        vi border[4];
        REP (l, 0, 4) {
            auto [ai, aj] = corners[l];
            REP (b, 0, 9) {
                if (a[ai][aj][b] == '1') {
                    ans += 1 << b;
                }
            }
            vi stk;
            stk.pb(0);
            int lvl = 0;
            REP (i, 0, SIDES[l] + SIDES[(l + 1) % 4] - 1) {
                int delta;
                if (a[ai][aj][9 + i * 2] == '1') {
                    delta = 0;
                } else if (a[ai][aj][9 + i * 2 + 1] == '0') {
                    delta = -1;
                } else {
                    delta = 1;
                }
                lvl += delta;
                if (delta == 1 && (lvl & 1)) {
                    stk.pb(ptr++);
                } else if (delta == -1 && (lvl & 1 ^ 1)) {
                    stk.pop_back();
                }
                if (lvl & 1) {
                    border[l].pb(stk.back());
                } else {
                    border[l].pb(0);
                }
            }
            for (int i : border[l]) {
                cerr << i << ' ';
            }
            cerr << '\n';
        }
        vector<vi> adj(ptr);
        REP (l, 0, 4) {
            int pl = l == 0 ? 3 : l - 1;
            REP (i, 0, SIDES[l]) {
                int u = border[l][i],
                    v = border[pl][SZ(border[pl]) - 1 - i];
                if (u == 0 || v == 0) {
                    continue;
                }
                adj[u].pb(v);
                adj[v].pb(u);
            }
        }
        vector<bool> vis(ptr);
        REP (i, 1, ptr) {
            if (vis[i]) {
                continue;
            }
            ans++;
            vis[i] = 1;
            queue<int> qu;
            qu.push(i);
            while (!qu.empty()) {
                int u = qu.front(); qu.pop();
                for (int v : adj[u]) {
                    if (vis[v]) {
                        continue;
                    }
                    vis[v] = 1;
                    qu.push(v);
                }
            }
        }
        string sans(100, '0');
        REP (l, 0, 30) {
            if (ans >> l & 1) {
                sans[l] = '1';
            }
        }
        return sans;
    }
}

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:394:48: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
  394 |                 } else if (delta == -1 && (lvl & 1 ^ 1)) {
      |                                            ~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
37 Correct 141 ms 4376 KB Output is correct
38 Correct 172 ms 4768 KB Output is correct
39 Correct 177 ms 4996 KB Output is correct
40 Correct 176 ms 4576 KB Output is correct
41 Correct 178 ms 4540 KB Output is correct
42 Correct 189 ms 4884 KB Output is correct
43 Correct 184 ms 4740 KB Output is correct
44 Correct 179 ms 4588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
37 Correct 141 ms 4376 KB Output is correct
38 Correct 172 ms 4768 KB Output is correct
39 Correct 177 ms 4996 KB Output is correct
40 Correct 176 ms 4576 KB Output is correct
41 Correct 178 ms 4540 KB Output is correct
42 Correct 189 ms 4884 KB Output is correct
43 Correct 184 ms 4740 KB Output is correct
44 Correct 179 ms 4588 KB Output is correct
45 Correct 234 ms 5120 KB Output is correct
46 Correct 286 ms 4964 KB Output is correct
47 Correct 285 ms 5020 KB Output is correct
48 Correct 300 ms 5224 KB Output is correct
49 Correct 293 ms 4436 KB Output is correct
50 Correct 289 ms 5216 KB Output is correct
51 Correct 286 ms 5456 KB Output is correct
52 Correct 289 ms 4812 KB Output is correct
53 Correct 305 ms 5060 KB Output is correct
54 Correct 281 ms 4956 KB Output is correct
55 Correct 292 ms 4992 KB Output is correct
56 Correct 283 ms 4952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
37 Correct 141 ms 4376 KB Output is correct
38 Correct 172 ms 4768 KB Output is correct
39 Correct 177 ms 4996 KB Output is correct
40 Correct 176 ms 4576 KB Output is correct
41 Correct 178 ms 4540 KB Output is correct
42 Correct 189 ms 4884 KB Output is correct
43 Correct 184 ms 4740 KB Output is correct
44 Correct 179 ms 4588 KB Output is correct
45 Correct 234 ms 5120 KB Output is correct
46 Correct 286 ms 4964 KB Output is correct
47 Correct 285 ms 5020 KB Output is correct
48 Correct 300 ms 5224 KB Output is correct
49 Correct 293 ms 4436 KB Output is correct
50 Correct 289 ms 5216 KB Output is correct
51 Correct 286 ms 5456 KB Output is correct
52 Correct 289 ms 4812 KB Output is correct
53 Correct 305 ms 5060 KB Output is correct
54 Correct 281 ms 4956 KB Output is correct
55 Correct 292 ms 4992 KB Output is correct
56 Correct 283 ms 4952 KB Output is correct
57 Correct 368 ms 5028 KB Output is correct
58 Correct 426 ms 5788 KB Output is correct
59 Correct 444 ms 5256 KB Output is correct
60 Correct 442 ms 5484 KB Output is correct
61 Correct 438 ms 6028 KB Output is correct
62 Correct 450 ms 5972 KB Output is correct
63 Correct 451 ms 5484 KB Output is correct
64 Correct 482 ms 5992 KB Output is correct
65 Correct 440 ms 5264 KB Output is correct
66 Correct 441 ms 5956 KB Output is correct
67 Correct 443 ms 6048 KB Output is correct
68 Correct 428 ms 5388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
37 Correct 141 ms 4376 KB Output is correct
38 Correct 172 ms 4768 KB Output is correct
39 Correct 177 ms 4996 KB Output is correct
40 Correct 176 ms 4576 KB Output is correct
41 Correct 178 ms 4540 KB Output is correct
42 Correct 189 ms 4884 KB Output is correct
43 Correct 184 ms 4740 KB Output is correct
44 Correct 179 ms 4588 KB Output is correct
45 Correct 234 ms 5120 KB Output is correct
46 Correct 286 ms 4964 KB Output is correct
47 Correct 285 ms 5020 KB Output is correct
48 Correct 300 ms 5224 KB Output is correct
49 Correct 293 ms 4436 KB Output is correct
50 Correct 289 ms 5216 KB Output is correct
51 Correct 286 ms 5456 KB Output is correct
52 Correct 289 ms 4812 KB Output is correct
53 Correct 305 ms 5060 KB Output is correct
54 Correct 281 ms 4956 KB Output is correct
55 Correct 292 ms 4992 KB Output is correct
56 Correct 283 ms 4952 KB Output is correct
57 Correct 368 ms 5028 KB Output is correct
58 Correct 426 ms 5788 KB Output is correct
59 Correct 444 ms 5256 KB Output is correct
60 Correct 442 ms 5484 KB Output is correct
61 Correct 438 ms 6028 KB Output is correct
62 Correct 450 ms 5972 KB Output is correct
63 Correct 451 ms 5484 KB Output is correct
64 Correct 482 ms 5992 KB Output is correct
65 Correct 440 ms 5264 KB Output is correct
66 Correct 441 ms 5956 KB Output is correct
67 Correct 443 ms 6048 KB Output is correct
68 Correct 428 ms 5388 KB Output is correct
69 Correct 584 ms 5724 KB Output is correct
70 Correct 622 ms 6328 KB Output is correct
71 Correct 630 ms 6232 KB Output is correct
72 Correct 629 ms 6068 KB Output is correct
73 Correct 660 ms 5892 KB Output is correct
74 Correct 659 ms 6008 KB Output is correct
75 Correct 662 ms 5756 KB Output is correct
76 Correct 619 ms 5856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4108 KB Output is correct
2 Correct 4 ms 3948 KB Output is correct
3 Correct 6 ms 4168 KB Output is correct
4 Correct 4 ms 3472 KB Output is correct
5 Correct 8 ms 3860 KB Output is correct
6 Correct 7 ms 4132 KB Output is correct
7 Correct 10 ms 3716 KB Output is correct
8 Correct 8 ms 4108 KB Output is correct
9 Correct 8 ms 3964 KB Output is correct
10 Correct 9 ms 3452 KB Output is correct
11 Correct 8 ms 3860 KB Output is correct
12 Correct 8 ms 4040 KB Output is correct
13 Correct 8 ms 4108 KB Output is correct
14 Correct 16 ms 4224 KB Output is correct
15 Correct 23 ms 4452 KB Output is correct
16 Correct 23 ms 3900 KB Output is correct
17 Correct 23 ms 4204 KB Output is correct
18 Correct 24 ms 3952 KB Output is correct
19 Correct 23 ms 4520 KB Output is correct
20 Correct 23 ms 4596 KB Output is correct
21 Correct 34 ms 4396 KB Output is correct
22 Correct 52 ms 3992 KB Output is correct
23 Correct 52 ms 4416 KB Output is correct
24 Correct 53 ms 4408 KB Output is correct
25 Correct 53 ms 4444 KB Output is correct
26 Correct 58 ms 4212 KB Output is correct
27 Correct 56 ms 4332 KB Output is correct
28 Correct 53 ms 4628 KB Output is correct
29 Correct 83 ms 4384 KB Output is correct
30 Correct 94 ms 4080 KB Output is correct
31 Correct 103 ms 4500 KB Output is correct
32 Correct 108 ms 4400 KB Output is correct
33 Correct 106 ms 4728 KB Output is correct
34 Correct 109 ms 4232 KB Output is correct
35 Correct 97 ms 4088 KB Output is correct
36 Correct 98 ms 4432 KB Output is correct
37 Correct 141 ms 4376 KB Output is correct
38 Correct 172 ms 4768 KB Output is correct
39 Correct 177 ms 4996 KB Output is correct
40 Correct 176 ms 4576 KB Output is correct
41 Correct 178 ms 4540 KB Output is correct
42 Correct 189 ms 4884 KB Output is correct
43 Correct 184 ms 4740 KB Output is correct
44 Correct 179 ms 4588 KB Output is correct
45 Correct 234 ms 5120 KB Output is correct
46 Correct 286 ms 4964 KB Output is correct
47 Correct 285 ms 5020 KB Output is correct
48 Correct 300 ms 5224 KB Output is correct
49 Correct 293 ms 4436 KB Output is correct
50 Correct 289 ms 5216 KB Output is correct
51 Correct 286 ms 5456 KB Output is correct
52 Correct 289 ms 4812 KB Output is correct
53 Correct 305 ms 5060 KB Output is correct
54 Correct 281 ms 4956 KB Output is correct
55 Correct 292 ms 4992 KB Output is correct
56 Correct 283 ms 4952 KB Output is correct
57 Correct 368 ms 5028 KB Output is correct
58 Correct 426 ms 5788 KB Output is correct
59 Correct 444 ms 5256 KB Output is correct
60 Correct 442 ms 5484 KB Output is correct
61 Correct 438 ms 6028 KB Output is correct
62 Correct 450 ms 5972 KB Output is correct
63 Correct 451 ms 5484 KB Output is correct
64 Correct 482 ms 5992 KB Output is correct
65 Correct 440 ms 5264 KB Output is correct
66 Correct 441 ms 5956 KB Output is correct
67 Correct 443 ms 6048 KB Output is correct
68 Correct 428 ms 5388 KB Output is correct
69 Correct 584 ms 5724 KB Output is correct
70 Correct 622 ms 6328 KB Output is correct
71 Correct 630 ms 6232 KB Output is correct
72 Correct 629 ms 6068 KB Output is correct
73 Correct 660 ms 5892 KB Output is correct
74 Correct 659 ms 6008 KB Output is correct
75 Correct 662 ms 5756 KB Output is correct
76 Correct 619 ms 5856 KB Output is correct
77 Correct 667 ms 6524 KB Output is correct
78 Correct 875 ms 6972 KB Output is correct
79 Correct 897 ms 7080 KB Output is correct
80 Correct 884 ms 6856 KB Output is correct
81 Correct 947 ms 6952 KB Output is correct
82 Correct 958 ms 6712 KB Output is correct
83 Correct 954 ms 7032 KB Output is correct
84 Correct 881 ms 6104 KB Output is correct