Submission #973766

# Submission time Handle Problem Language Result Execution time Memory
973766 2024-05-02T10:45:37 Z Pannda Mars (APIO22_mars) C++17
100 / 100
772 ms 6820 KB
#include "mars.h"

#include <bits/stdc++.h>
using namespace std;

struct DSU {
    int cnt;
    vector<int> f;

    DSU(int n) : cnt(n), f(n) { iota(f.begin(), f.end(), 0); }

    int leader(int u) {
        while (u != f[u]) {
            u = f[u] = f[f[u]];
        }
        return u;
    }

    bool unionize(int u, int v) {
        u = leader(u);
        v = leader(v);
        if (u == v) return false;
        f[u] = v;
        cnt--;
        return true;
    }

    int count() {
        return cnt;
    }

    bool same(int u, int v) {
        return leader(u) == leader(v);
    }
};

int string_to_int(string s) {
    int res = 0;
    for (int i = 0; i < s.size(); i++) {
        res += (s[i] - '0') * (1 << i);
    }
    return res;
}

string int_to_string(int x, int length) {
    string res;
    for (int i = 0; i < length; i++) {
        res.push_back('0' + (x & 1));
        x >>= 1;
    }
    return res;
}

string _process(vector<vector<string>> a, int i, int j, int k, int n)
{
    int m = 2 * (n - k - 1);
    if (i != m && j != m) return a[0][0];

    if (i < j) {
        string s(100, '0');
        s[0] = a[0][0][0];
        s[1] = a[0][1][0];
        for (int x = 2; x < 50; x++) {
            s[x] = a[0][2][x - 2];
        }
        s[50] = a[1][0][0];
        s[51] = a[1][1][0];
        for (int x = 52; x < 100; x++) {
            s[x] = a[1][2][x - 52];
        }
        return s;
    }

    if (i > j) {
        string s(100, '0');
        s[0] = a[0][0][0];
        s[1] = a[1][0][0];
        for (int x = 2; x < 50; x++) {
            s[x] = a[2][0][x - 2];
        }
        s[50] = a[0][1][0];
        s[51] = a[1][1][0];
        for (int x = 52; x < 100; x++) {
            s[x] = a[2][1][x - 52];
        }
        return s;
    }

    int d = 2 * n + 1 - m;

    vector<array<int, 2>> dxy = { {-1, 0}, {+1, 0}, {0, -1}, {0, +1} };
    auto valid = [&](int x, int y) {
        if (x < 0 || x >= d || y < 0 || y >= d) return false;
        return true;
    };
    auto neighbour = [&](int x, int y) {
        vector<array<int, 2>> res;
        for (auto [dx, dy] : dxy) {
            if (valid(x + dx, y + dy)) res.push_back({x + dx, y + dy});
        }
        return res;
    };

    auto [mp, cnt, id] = [&]() -> tuple<vector<vector<bool>>, int, vector<vector<int>>> {
        vector<vector<bool>> mp(d, vector<bool>(d, 0));
        for (int x = 0; x < 2; x++) {
            for (int y = 0; y < 2; y++) {
                mp[x][y] = a[x][y][0] - '0';
            }
        }
        for (int x = 0; x < 2; x++) {
            for (int y = 2; y < d; y++) {
                mp[x][y] = a[x][2][y - 2] - '0';
                mp[x + 1][y] = k == 0 ? a[x + 1][2][y - 2] - '0' : a[x][2][50 + y - 2] - '0';
            }
        }
        for (int y = 0; y < 2; y++) {
            for (int x = 2; x < d; x++) {
                mp[x][y] = a[2][y][x - 2] - '0';
                mp[x][y + 1] = k == 0 ? a[2][y + 1][x - 2] - '0' : a[2][y][50 + x - 2] - '0';
            }
        }
        int cnt = 0;
        vector<vector<int>> id(d, vector<int>(d, -1));
        for (int x = 0; x < d; x++) {
            for (int y = 0; y < d; y++) {
                if (mp[x][y]) {
                    id[x][y] = cnt++;
                }
            }
        }
        return {mp, cnt, id};
    }();

    DSU dsu(cnt + 1);
    for (int x = 0; x < d; x++) {
        for (int y = 0; y < d; y++) {
            for (auto [xx, yy] : neighbour(x, y)) {
                if (mp[x][y] && mp[xx][yy]) {
                    dsu.unionize(id[x][y], id[xx][yy]);
                }
            }
        }
    }

    auto [config, seq] = [&] {
        vector<array<int, 2>> config;
        vector<int> seq;
        for (int x = d - 1; x >= 2; x--) if (mp[x][2] && (x == d - 1 || !mp[x + 1][2])) config.push_back({x, 2});
        for (int y = 3; y < d; y++) if (mp[2][y] && !mp[2][y - 1]) config.push_back({2, y});
        for (int i = 0; i < config.size(); i++) seq.push_back(string_to_int(a[2][2].substr(2 * i, 2)));
        if (k == 0 && !seq.empty()) seq[0] = 0;
        return make_pair(config, seq);
    }();

    vector<array<int, 2>> stk;
    for (int i = 0; i < config.size(); i++) {
        if (seq[i] & 1) { // close
            auto [x, y] = config[i];
            auto [xx, yy] = stk.back();
            dsu.unionize(id[x][y], id[xx][yy]);
            stk.pop_back();
        }
        if (seq[i] & 2) { // open
            stk.push_back(config[i]);
        }
    }

    int fetch = string_to_int(a[2][2].substr(85));

    if (k == n - 1) {
        return int_to_string(dsu.count() - 1 + fetch, 100);
    } else {
        string res;
        vector<array<int, 2>> config;
        for (int x = d - 1; x >= 0; x--) if (mp[x][0] && (x == d - 1 || !mp[x + 1][0])) config.push_back({x, 0});
        for (int y = 1; y < d; y++) if (mp[0][y] && !mp[0][y - 1]) config.push_back({0, y});
        for (int i = 0; i < config.size(); i++) {
            bool close = false;
            bool open = false;
            auto [x, y] = config[i];
            for (int j = 0; j < config.size(); j++) {
                auto [xx, yy] = config[j];
                if (dsu.same(id[x][y], id[xx][yy])) {
                    if (j < i) close = true;
                    if (i < j) open = true;
                }
            }
            res.push_back('0' + close);
            res.push_back('0' + open);
        }
        for (auto [x, y] : config) {
            dsu.unionize(id[x][y], cnt);
        }
        while (res.size() < 85) res.push_back('0');
        res += int_to_string(dsu.count() - 1 + fetch, 15);
        return res;
    }
}

string process(vector<vector<string>> a, int i, int j, int k, int n) {
    string s = _process(a, i, j, k, n);
//    cout << k << ' ' << i << ' ' << j << ": " << s << '\n';
    return s;
}

Compilation message

mars.cpp: In function 'int string_to_int(std::string)':
mars.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i = 0; i < s.size(); i++) {
      |                     ~~^~~~~~~~~~
mars.cpp: In lambda function:
mars.cpp:151:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  151 |         for (int i = 0; i < config.size(); i++) seq.push_back(string_to_int(a[2][2].substr(2 * i, 2)));
      |                         ~~^~~~~~~~~~~~~~~
mars.cpp: In function 'std::string _process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:157:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  157 |     for (int i = 0; i < config.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~
mars.cpp:178:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  178 |         for (int i = 0; i < config.size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~
mars.cpp:182:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  182 |             for (int j = 0; j < config.size(); j++) {
      |                             ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
37 Correct 133 ms 4428 KB Output is correct
38 Correct 168 ms 4288 KB Output is correct
39 Correct 165 ms 5156 KB Output is correct
40 Correct 170 ms 5196 KB Output is correct
41 Correct 165 ms 4796 KB Output is correct
42 Correct 172 ms 4676 KB Output is correct
43 Correct 167 ms 4764 KB Output is correct
44 Correct 164 ms 4756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
37 Correct 133 ms 4428 KB Output is correct
38 Correct 168 ms 4288 KB Output is correct
39 Correct 165 ms 5156 KB Output is correct
40 Correct 170 ms 5196 KB Output is correct
41 Correct 165 ms 4796 KB Output is correct
42 Correct 172 ms 4676 KB Output is correct
43 Correct 167 ms 4764 KB Output is correct
44 Correct 164 ms 4756 KB Output is correct
45 Correct 217 ms 4636 KB Output is correct
46 Correct 257 ms 4852 KB Output is correct
47 Correct 267 ms 5316 KB Output is correct
48 Correct 267 ms 5208 KB Output is correct
49 Correct 269 ms 4888 KB Output is correct
50 Correct 267 ms 5088 KB Output is correct
51 Correct 272 ms 4976 KB Output is correct
52 Correct 269 ms 5100 KB Output is correct
53 Correct 264 ms 5160 KB Output is correct
54 Correct 266 ms 4424 KB Output is correct
55 Correct 277 ms 4496 KB Output is correct
56 Correct 258 ms 4980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
37 Correct 133 ms 4428 KB Output is correct
38 Correct 168 ms 4288 KB Output is correct
39 Correct 165 ms 5156 KB Output is correct
40 Correct 170 ms 5196 KB Output is correct
41 Correct 165 ms 4796 KB Output is correct
42 Correct 172 ms 4676 KB Output is correct
43 Correct 167 ms 4764 KB Output is correct
44 Correct 164 ms 4756 KB Output is correct
45 Correct 217 ms 4636 KB Output is correct
46 Correct 257 ms 4852 KB Output is correct
47 Correct 267 ms 5316 KB Output is correct
48 Correct 267 ms 5208 KB Output is correct
49 Correct 269 ms 4888 KB Output is correct
50 Correct 267 ms 5088 KB Output is correct
51 Correct 272 ms 4976 KB Output is correct
52 Correct 269 ms 5100 KB Output is correct
53 Correct 264 ms 5160 KB Output is correct
54 Correct 266 ms 4424 KB Output is correct
55 Correct 277 ms 4496 KB Output is correct
56 Correct 258 ms 4980 KB Output is correct
57 Correct 335 ms 5008 KB Output is correct
58 Correct 394 ms 5924 KB Output is correct
59 Correct 397 ms 5100 KB Output is correct
60 Correct 389 ms 5760 KB Output is correct
61 Correct 389 ms 5452 KB Output is correct
62 Correct 391 ms 5456 KB Output is correct
63 Correct 389 ms 5168 KB Output is correct
64 Correct 404 ms 5852 KB Output is correct
65 Correct 392 ms 6000 KB Output is correct
66 Correct 390 ms 5372 KB Output is correct
67 Correct 421 ms 5516 KB Output is correct
68 Correct 410 ms 5968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
37 Correct 133 ms 4428 KB Output is correct
38 Correct 168 ms 4288 KB Output is correct
39 Correct 165 ms 5156 KB Output is correct
40 Correct 170 ms 5196 KB Output is correct
41 Correct 165 ms 4796 KB Output is correct
42 Correct 172 ms 4676 KB Output is correct
43 Correct 167 ms 4764 KB Output is correct
44 Correct 164 ms 4756 KB Output is correct
45 Correct 217 ms 4636 KB Output is correct
46 Correct 257 ms 4852 KB Output is correct
47 Correct 267 ms 5316 KB Output is correct
48 Correct 267 ms 5208 KB Output is correct
49 Correct 269 ms 4888 KB Output is correct
50 Correct 267 ms 5088 KB Output is correct
51 Correct 272 ms 4976 KB Output is correct
52 Correct 269 ms 5100 KB Output is correct
53 Correct 264 ms 5160 KB Output is correct
54 Correct 266 ms 4424 KB Output is correct
55 Correct 277 ms 4496 KB Output is correct
56 Correct 258 ms 4980 KB Output is correct
57 Correct 335 ms 5008 KB Output is correct
58 Correct 394 ms 5924 KB Output is correct
59 Correct 397 ms 5100 KB Output is correct
60 Correct 389 ms 5760 KB Output is correct
61 Correct 389 ms 5452 KB Output is correct
62 Correct 391 ms 5456 KB Output is correct
63 Correct 389 ms 5168 KB Output is correct
64 Correct 404 ms 5852 KB Output is correct
65 Correct 392 ms 6000 KB Output is correct
66 Correct 390 ms 5372 KB Output is correct
67 Correct 421 ms 5516 KB Output is correct
68 Correct 410 ms 5968 KB Output is correct
69 Correct 489 ms 5972 KB Output is correct
70 Correct 582 ms 5760 KB Output is correct
71 Correct 571 ms 6552 KB Output is correct
72 Correct 559 ms 6124 KB Output is correct
73 Correct 577 ms 6044 KB Output is correct
74 Correct 555 ms 6504 KB Output is correct
75 Correct 566 ms 5520 KB Output is correct
76 Correct 561 ms 6212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3956 KB Output is correct
2 Correct 5 ms 3788 KB Output is correct
3 Correct 4 ms 3864 KB Output is correct
4 Correct 5 ms 3864 KB Output is correct
5 Correct 7 ms 3600 KB Output is correct
6 Correct 5 ms 4116 KB Output is correct
7 Correct 8 ms 3948 KB Output is correct
8 Correct 10 ms 3852 KB Output is correct
9 Correct 8 ms 3524 KB Output is correct
10 Correct 9 ms 3684 KB Output is correct
11 Correct 10 ms 3920 KB Output is correct
12 Correct 8 ms 3856 KB Output is correct
13 Correct 10 ms 3864 KB Output is correct
14 Correct 18 ms 4016 KB Output is correct
15 Correct 24 ms 4536 KB Output is correct
16 Correct 23 ms 4392 KB Output is correct
17 Correct 23 ms 4120 KB Output is correct
18 Correct 23 ms 4088 KB Output is correct
19 Correct 23 ms 4704 KB Output is correct
20 Correct 23 ms 4264 KB Output is correct
21 Correct 35 ms 4128 KB Output is correct
22 Correct 51 ms 4168 KB Output is correct
23 Correct 52 ms 4028 KB Output is correct
24 Correct 49 ms 4456 KB Output is correct
25 Correct 51 ms 3720 KB Output is correct
26 Correct 55 ms 4340 KB Output is correct
27 Correct 52 ms 4332 KB Output is correct
28 Correct 51 ms 4516 KB Output is correct
29 Correct 74 ms 4792 KB Output is correct
30 Correct 105 ms 4324 KB Output is correct
31 Correct 94 ms 4012 KB Output is correct
32 Correct 102 ms 4400 KB Output is correct
33 Correct 96 ms 4160 KB Output is correct
34 Correct 98 ms 4476 KB Output is correct
35 Correct 96 ms 3992 KB Output is correct
36 Correct 103 ms 4112 KB Output is correct
37 Correct 133 ms 4428 KB Output is correct
38 Correct 168 ms 4288 KB Output is correct
39 Correct 165 ms 5156 KB Output is correct
40 Correct 170 ms 5196 KB Output is correct
41 Correct 165 ms 4796 KB Output is correct
42 Correct 172 ms 4676 KB Output is correct
43 Correct 167 ms 4764 KB Output is correct
44 Correct 164 ms 4756 KB Output is correct
45 Correct 217 ms 4636 KB Output is correct
46 Correct 257 ms 4852 KB Output is correct
47 Correct 267 ms 5316 KB Output is correct
48 Correct 267 ms 5208 KB Output is correct
49 Correct 269 ms 4888 KB Output is correct
50 Correct 267 ms 5088 KB Output is correct
51 Correct 272 ms 4976 KB Output is correct
52 Correct 269 ms 5100 KB Output is correct
53 Correct 264 ms 5160 KB Output is correct
54 Correct 266 ms 4424 KB Output is correct
55 Correct 277 ms 4496 KB Output is correct
56 Correct 258 ms 4980 KB Output is correct
57 Correct 335 ms 5008 KB Output is correct
58 Correct 394 ms 5924 KB Output is correct
59 Correct 397 ms 5100 KB Output is correct
60 Correct 389 ms 5760 KB Output is correct
61 Correct 389 ms 5452 KB Output is correct
62 Correct 391 ms 5456 KB Output is correct
63 Correct 389 ms 5168 KB Output is correct
64 Correct 404 ms 5852 KB Output is correct
65 Correct 392 ms 6000 KB Output is correct
66 Correct 390 ms 5372 KB Output is correct
67 Correct 421 ms 5516 KB Output is correct
68 Correct 410 ms 5968 KB Output is correct
69 Correct 489 ms 5972 KB Output is correct
70 Correct 582 ms 5760 KB Output is correct
71 Correct 571 ms 6552 KB Output is correct
72 Correct 559 ms 6124 KB Output is correct
73 Correct 577 ms 6044 KB Output is correct
74 Correct 555 ms 6504 KB Output is correct
75 Correct 566 ms 5520 KB Output is correct
76 Correct 561 ms 6212 KB Output is correct
77 Correct 583 ms 6028 KB Output is correct
78 Correct 758 ms 6664 KB Output is correct
79 Correct 761 ms 6500 KB Output is correct
80 Correct 772 ms 6108 KB Output is correct
81 Correct 755 ms 6060 KB Output is correct
82 Correct 765 ms 6800 KB Output is correct
83 Correct 771 ms 6732 KB Output is correct
84 Correct 760 ms 6820 KB Output is correct