Submission #802663

# Submission time Handle Problem Language Result Execution time Memory
802663 2023-08-02T13:12:24 Z puppy IOI Fever (JOI21_fever) C++17
100 / 100
1173 ms 135316 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
struct Dot
{
    ll x, y;
};
int N;
Dot dot[100005];
ll dir[100005];
ll dis[100005][8];
const ll inf = 1e10;
vector<pair<ll, int>> line[4][100005][4];
vector<pair<ll, int>> minor[100005][8];
int id[100005][4];
signed main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> dot[i].x >> dot[i].y;
        if (i >= 2) {
            dot[i].x -= dot[1].x;
            dot[i].y -= dot[1].y;
        }
    }
    dot[1] = {0, 0};
    int ans = 0;
    for (int k = 0; k < 4; k++) {
        for (int i = 2; i <= N; i++) {
            if (dot[i].y < dot[i].x && -dot[i].x < dot[i].y) {
                dir[i] = 2;
            }
            else if (dot[i].y >= dot[i].x && dot[i].y > -dot[i].x) {
                dir[i] = 3;
            }
            else if (dot[i].y < dot[i].x && dot[i].y <= -dot[i].x) {
                dir[i] = 1;
            }
            else {
                dir[i] = 0;
            }
        }
        vector<ll> cpx[4];
        for (int i = 1; i <= N; i++) {
            cpx[0].push_back(dot[i].y - dot[i].x);
            cpx[1].push_back(dot[i].x + dot[i].y);
            cpx[2].push_back(dot[i].y);
            cpx[3].push_back(dot[i].x);
        }
        for (int k = 0; k < 4; k++) {
            sort(all(cpx[k]));
            cpx[k].erase(unique(all(cpx[k])), cpx[k].end());
        }
        auto lb = [&](int k, ll i)
        {
            return lower_bound(all(cpx[k]), i) - cpx[k].begin();
        };
        for (int k = 0; k < 4; k++) {
            for (int i = 0; i < (int)cpx[k].size(); i++) {
                for (int j = 0; j < 4; j++) {
                    line[k][i][j].clear();
                }
            }
        }
        for (int i = 1; i <= N; i++) {
            for (int j = 0; j < 8; j++) {
                minor[i][j].clear();
            }
        }
        for (int i = 1; i <= N; i++) {
            id[i][0] = lb(0, dot[i].y - dot[i].x);
            id[i][1] = lb(1, dot[i].y + dot[i].x);
            id[i][2] = lb(2, dot[i].y);
            id[i][3] = lb(3, dot[i].x);
            line[0][id[i][0]][dir[i]].push_back(make_pair(dot[i].x, i));
            line[1][id[i][1]][dir[i]].push_back(make_pair(dot[i].x, i));
            line[2][id[i][2]][dir[i]].push_back(make_pair(dot[i].x, i));
            line[3][id[i][3]][dir[i]].push_back(make_pair(dot[i].y, i));
        }
        for (int k = 0; k < 4; k++) {
            for (int i = 0; i < (int)cpx[k].size(); i++) {
                for (int j = 0; j < 4; j++) {
                    sort(all(line[k][i][j]));
                    for (int l = 0; l < (int)line[k][i][j].size() - 1; l++) {
                        if (k < 2) {
                            minor[line[k][i][j][l].second][2*k].push_back(make_pair(2 * (line[k][i][j][l+1].first - line[k][i][j][l].first), line[k][i][j][l+1].second));
                            minor[line[k][i][j][l+1].second][2*k+1].push_back(make_pair(2 * (line[k][i][j][l+1].first - line[k][i][j][l].first), line[k][i][j][l].second));
                        }
                        else {
                            minor[line[k][i][j][l].second][2*k].push_back(make_pair(line[k][i][j][l+1].first - line[k][i][j][l].first, line[k][i][j][l+1].second));
                            minor[line[k][i][j][l+1].second][2*k+1].push_back(make_pair(line[k][i][j][l+1].first - line[k][i][j][l].first, line[k][i][j][l].second));
                        }
                    }
                }
            }
        }
        fill(&dis[0][0], &dis[100004][8], inf);
        priority_queue<pair<int, pair<int, int>>> pq; pq.push(make_pair(0, make_pair(1, -1)));
        while (!pq.empty()) {
            int ver = pq.top().second.first, state = pq.top().second.second;
            ll now = -pq.top().first;
            pq.pop();
            if (state != -1) {
                for (pair<int, int> p: minor[ver][state]) {
                    int nxt = p.second, newdis = now + p.first;
                    if (dis[nxt][state] > newdis) {
                        dis[nxt][state] = newdis;
                        pq.push(make_pair(-newdis, make_pair(nxt, state)));
                    }
                }
            }
            if (dir[ver] == 0) {
                auto it = lower_bound(all(line[0][id[ver][0]][3]), make_pair(dot[ver].x + (now + 1) / 2, -1));
                if (it != line[0][id[ver][0]][3].end() && dis[(*it).second][0] > 2 * ((*it).first - dot[ver].x)) {
                    dis[(*it).second][0] = 2 * ((*it).first - dot[ver].x);
                    pq.push(make_pair(-dis[(*it).second][0], make_pair((*it).second, 0)));
                }
                auto it2 = lower_bound(all(line[1][id[ver][1]][1]), make_pair(dot[ver].x + (now + 1) / 2, -1));
                if (it2 != line[1][id[ver][1]][1].end() && dis[(*it2).second][2] > 2 * ((*it2).first - dot[ver].x)) {
                    dis[(*it2).second][2] = 2 * ((*it2).first - dot[ver].x);
                    pq.push(make_pair(-dis[(*it2).second][2], make_pair((*it2).second, 2)));
                }
                auto it3 = lower_bound(all(line[2][id[ver][2]][2]), make_pair(dot[ver].x + now, -1));
                if (it3 != line[2][id[ver][2]][2].end() && dis[(*it3).second][4] > (*it3).first - dot[ver].x) {
                    dis[(*it3).second][4] = (*it3).first - dot[ver].x;
                    pq.push(make_pair(-dis[(*it3).second][4], make_pair((*it3).second, 4)));
                }
            }
            else if (dir[ver] == 1) {
                auto it = lower_bound(all(line[0][id[ver][0]][2]), make_pair(dot[ver].x + (now + 1) / 2, -1));
                if (it != line[0][id[ver][0]][2].end() && dis[(*it).second][0] > 2 * ((*it).first - dot[ver].x)) {
                    dis[(*it).second][0] = 2 * ((*it).first - dot[ver].x);
                    pq.push(make_pair(-dis[(*it).second][0], make_pair((*it).second, 0)));
                }
                auto it2 = lower_bound(all(line[1][id[ver][1]][0]), make_pair(dot[ver].x - (now + 1) / 2 + 1, -1));
                if (it2 != line[1][id[ver][1]][0].begin()) {
                    --it2;
                    if (dis[(*it2).second][3] > 2 * (dot[ver].x - (*it2).first)) {
                        dis[(*it2).second][3] = 2 * (dot[ver].x - (*it2).first);
                        pq.push(make_pair(-dis[(*it2).second][3], make_pair((*it2).second, 3)));
                    }
                }
                auto it3 = lower_bound(all(line[3][id[ver][3]][3]), make_pair(dot[ver].y + now, -1));
                if (it3 != line[3][id[ver][3]][3].end() && dis[(*it3).second][6] > (*it3).first - dot[ver].y) {
                    dis[(*it3).second][6] = (*it3).first - dot[ver].y;
                    pq.push(make_pair(-dis[(*it3).second][6], make_pair((*it3).second, 6)));
                }
            }
            else if (dir[ver] == 2) {
                auto it = lower_bound(all(line[0][id[ver][0]][1]), make_pair(dot[ver].x - (now + 1) / 2 + 1, -1));
                if (it != line[0][id[ver][0]][1].begin()) {
                    --it;
                    if (dis[(*it).second][1] > 2 * (dot[ver].x - (*it).first)) {
                        dis[(*it).second][1] = 2 * (dot[ver].x - (*it).first);
                        pq.push(make_pair(-dis[(*it).second][1], make_pair((*it).second, 1)));
                    }
                }
                auto it2 = lower_bound(all(line[1][id[ver][1]][3]), make_pair(dot[ver].x - (now + 1) / 2 + 1, -1));
                if (it2 != line[1][id[ver][1]][3].begin()) {
                    --it2;
                    if (dis[(*it2).second][3] > 2 * (dot[ver].x - (*it2).first)) {
                        dis[(*it2).second][3] = 2 * (dot[ver].x - (*it2).first);
                        pq.push(make_pair(-dis[(*it2).second][3], make_pair((*it2).second, 3)));
                    }
                }
                auto it3 = lower_bound(all(line[2][id[ver][2]][0]), make_pair(dot[ver].x - now + 1, -1));
                if (it3 != line[2][id[ver][2]][0].begin()) {
                    --it3;
                    if (dis[(*it3).second][5] > dot[ver].x - (*it3).first) {
                        dis[(*it3).second][5] = dot[ver].x - (*it3).first;
                        pq.push(make_pair(-dis[(*it3).second][5], make_pair((*it3).second, 5)));
                    }
                }
            }
            else {
                auto it = lower_bound(all(line[0][id[ver][0]][0]), make_pair(dot[ver].x - (now + 1) / 2 + 1, -1));
                if (it != line[0][id[ver][0]][0].begin()) {
                    --it;
                    if (dis[(*it).second][1] > 2 * (dot[ver].x - (*it).first)) {
                        dis[(*it).second][1] = 2 * (dot[ver].x - (*it).first);
                        pq.push(make_pair(-dis[(*it).second][1], make_pair((*it).second, 1)));
                    }
                }
                auto it2 = lower_bound(all(line[1][id[ver][1]][2]), make_pair(dot[ver].x + (now + 1) / 2, -1));
                if (it2 != line[1][id[ver][1]][2].end() && dis[(*it2).second][2] > 2 * ((*it2).first - dot[ver].x)) {
                    dis[(*it2).second][2] = 2 * ((*it2).first - dot[ver].x);
                    pq.push(make_pair(-dis[(*it2).second][2], make_pair((*it2).second, 2)));
                }
                auto it3 = lower_bound(all(line[3][id[ver][3]][1]), make_pair(dot[ver].y - now + 1, -1));
                if (it3 != line[3][id[ver][3]][1].begin()) {
                    --it3;
                    if (dis[(*it3).second][7] > dot[ver].y - (*it3).first) {
                        dis[(*it3).second][7] = dot[ver].y - (*it3).first;
                        pq.push(make_pair(-dis[(*it3).second][7], make_pair((*it3).second, 7)));
                    }
                }
            }
        }
        int res = 1;
        for (int i = 2; i <= N; i++) {
            bool flag = false;
            for (int j = 0; j < 8; j++) flag |= dis[i][j] != inf;
            res += flag;
        }
        ans = max(ans, res);
        for (int i = 2; i <= N; i++) {
            ll tmp = dot[i].y;
            dot[i].y = dot[i].x;
            dot[i].x = -tmp;
        }
        dir[1] = 0;
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
33 Correct 30 ms 62952 KB Output is correct
34 Correct 33 ms 62952 KB Output is correct
35 Correct 29 ms 62924 KB Output is correct
36 Correct 30 ms 62868 KB Output is correct
37 Correct 30 ms 62836 KB Output is correct
38 Correct 30 ms 62956 KB Output is correct
39 Correct 31 ms 62932 KB Output is correct
40 Correct 31 ms 62932 KB Output is correct
41 Correct 30 ms 62876 KB Output is correct
42 Correct 34 ms 62884 KB Output is correct
43 Correct 39 ms 62916 KB Output is correct
44 Correct 34 ms 62932 KB Output is correct
45 Correct 31 ms 62828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 62932 KB Output is correct
2 Correct 33 ms 63000 KB Output is correct
3 Correct 30 ms 62976 KB Output is correct
4 Correct 31 ms 62924 KB Output is correct
5 Correct 32 ms 62980 KB Output is correct
6 Correct 35 ms 63056 KB Output is correct
7 Correct 35 ms 62924 KB Output is correct
8 Correct 32 ms 62988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
33 Correct 30 ms 62952 KB Output is correct
34 Correct 33 ms 62952 KB Output is correct
35 Correct 29 ms 62924 KB Output is correct
36 Correct 30 ms 62868 KB Output is correct
37 Correct 30 ms 62836 KB Output is correct
38 Correct 30 ms 62956 KB Output is correct
39 Correct 31 ms 62932 KB Output is correct
40 Correct 31 ms 62932 KB Output is correct
41 Correct 30 ms 62876 KB Output is correct
42 Correct 34 ms 62884 KB Output is correct
43 Correct 39 ms 62916 KB Output is correct
44 Correct 34 ms 62932 KB Output is correct
45 Correct 31 ms 62828 KB Output is correct
46 Correct 31 ms 62932 KB Output is correct
47 Correct 33 ms 63000 KB Output is correct
48 Correct 30 ms 62976 KB Output is correct
49 Correct 31 ms 62924 KB Output is correct
50 Correct 32 ms 62980 KB Output is correct
51 Correct 35 ms 63056 KB Output is correct
52 Correct 35 ms 62924 KB Output is correct
53 Correct 32 ms 62988 KB Output is correct
54 Correct 34 ms 62996 KB Output is correct
55 Correct 31 ms 62928 KB Output is correct
56 Correct 31 ms 62956 KB Output is correct
57 Correct 30 ms 62904 KB Output is correct
58 Correct 30 ms 62920 KB Output is correct
59 Correct 32 ms 62932 KB Output is correct
60 Correct 30 ms 62936 KB Output is correct
61 Correct 37 ms 62924 KB Output is correct
62 Correct 30 ms 62924 KB Output is correct
63 Correct 30 ms 62916 KB Output is correct
64 Correct 31 ms 62996 KB Output is correct
65 Correct 31 ms 62992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
33 Correct 30 ms 62952 KB Output is correct
34 Correct 33 ms 62952 KB Output is correct
35 Correct 29 ms 62924 KB Output is correct
36 Correct 30 ms 62868 KB Output is correct
37 Correct 30 ms 62836 KB Output is correct
38 Correct 30 ms 62956 KB Output is correct
39 Correct 31 ms 62932 KB Output is correct
40 Correct 31 ms 62932 KB Output is correct
41 Correct 30 ms 62876 KB Output is correct
42 Correct 34 ms 62884 KB Output is correct
43 Correct 39 ms 62916 KB Output is correct
44 Correct 34 ms 62932 KB Output is correct
45 Correct 31 ms 62828 KB Output is correct
46 Correct 31 ms 62932 KB Output is correct
47 Correct 33 ms 63000 KB Output is correct
48 Correct 30 ms 62976 KB Output is correct
49 Correct 31 ms 62924 KB Output is correct
50 Correct 32 ms 62980 KB Output is correct
51 Correct 35 ms 63056 KB Output is correct
52 Correct 35 ms 62924 KB Output is correct
53 Correct 32 ms 62988 KB Output is correct
54 Correct 34 ms 62996 KB Output is correct
55 Correct 31 ms 62928 KB Output is correct
56 Correct 31 ms 62956 KB Output is correct
57 Correct 30 ms 62904 KB Output is correct
58 Correct 30 ms 62920 KB Output is correct
59 Correct 32 ms 62932 KB Output is correct
60 Correct 30 ms 62936 KB Output is correct
61 Correct 37 ms 62924 KB Output is correct
62 Correct 30 ms 62924 KB Output is correct
63 Correct 30 ms 62916 KB Output is correct
64 Correct 31 ms 62996 KB Output is correct
65 Correct 31 ms 62992 KB Output is correct
66 Correct 45 ms 64564 KB Output is correct
67 Correct 42 ms 64520 KB Output is correct
68 Correct 40 ms 63944 KB Output is correct
69 Correct 56 ms 64528 KB Output is correct
70 Correct 43 ms 64724 KB Output is correct
71 Correct 49 ms 64776 KB Output is correct
72 Correct 44 ms 64460 KB Output is correct
73 Correct 41 ms 64040 KB Output is correct
74 Correct 44 ms 64744 KB Output is correct
75 Correct 41 ms 64680 KB Output is correct
76 Correct 42 ms 64296 KB Output is correct
77 Correct 44 ms 64832 KB Output is correct
78 Correct 45 ms 64152 KB Output is correct
79 Correct 40 ms 64212 KB Output is correct
80 Correct 40 ms 63900 KB Output is correct
81 Correct 41 ms 63828 KB Output is correct
82 Correct 50 ms 64912 KB Output is correct
83 Correct 43 ms 64732 KB Output is correct
84 Correct 45 ms 64964 KB Output is correct
85 Correct 41 ms 64920 KB Output is correct
86 Correct 37 ms 64776 KB Output is correct
87 Correct 36 ms 65032 KB Output is correct
88 Correct 37 ms 64676 KB Output is correct
89 Correct 38 ms 63744 KB Output is correct
90 Correct 38 ms 63768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
33 Correct 30 ms 62952 KB Output is correct
34 Correct 33 ms 62952 KB Output is correct
35 Correct 29 ms 62924 KB Output is correct
36 Correct 30 ms 62868 KB Output is correct
37 Correct 30 ms 62836 KB Output is correct
38 Correct 30 ms 62956 KB Output is correct
39 Correct 31 ms 62932 KB Output is correct
40 Correct 31 ms 62932 KB Output is correct
41 Correct 30 ms 62876 KB Output is correct
42 Correct 34 ms 62884 KB Output is correct
43 Correct 39 ms 62916 KB Output is correct
44 Correct 34 ms 62932 KB Output is correct
45 Correct 31 ms 62828 KB Output is correct
46 Correct 31 ms 62932 KB Output is correct
47 Correct 33 ms 63000 KB Output is correct
48 Correct 30 ms 62976 KB Output is correct
49 Correct 31 ms 62924 KB Output is correct
50 Correct 32 ms 62980 KB Output is correct
51 Correct 35 ms 63056 KB Output is correct
52 Correct 35 ms 62924 KB Output is correct
53 Correct 32 ms 62988 KB Output is correct
54 Correct 34 ms 62996 KB Output is correct
55 Correct 31 ms 62928 KB Output is correct
56 Correct 31 ms 62956 KB Output is correct
57 Correct 30 ms 62904 KB Output is correct
58 Correct 30 ms 62920 KB Output is correct
59 Correct 32 ms 62932 KB Output is correct
60 Correct 30 ms 62936 KB Output is correct
61 Correct 37 ms 62924 KB Output is correct
62 Correct 30 ms 62924 KB Output is correct
63 Correct 30 ms 62916 KB Output is correct
64 Correct 31 ms 62996 KB Output is correct
65 Correct 31 ms 62992 KB Output is correct
66 Correct 615 ms 95060 KB Output is correct
67 Correct 823 ms 111904 KB Output is correct
68 Correct 791 ms 106716 KB Output is correct
69 Correct 743 ms 120928 KB Output is correct
70 Correct 799 ms 107708 KB Output is correct
71 Correct 718 ms 99228 KB Output is correct
72 Correct 724 ms 98976 KB Output is correct
73 Correct 808 ms 120528 KB Output is correct
74 Correct 714 ms 98904 KB Output is correct
75 Correct 782 ms 97932 KB Output is correct
76 Correct 675 ms 106428 KB Output is correct
77 Correct 716 ms 95900 KB Output is correct
78 Correct 620 ms 87516 KB Output is correct
79 Correct 643 ms 87520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 62932 KB Output is correct
2 Correct 34 ms 62948 KB Output is correct
3 Correct 30 ms 62948 KB Output is correct
4 Correct 34 ms 62888 KB Output is correct
5 Correct 29 ms 62940 KB Output is correct
6 Correct 36 ms 62848 KB Output is correct
7 Correct 36 ms 62924 KB Output is correct
8 Correct 35 ms 62932 KB Output is correct
9 Correct 36 ms 62836 KB Output is correct
10 Correct 32 ms 62848 KB Output is correct
11 Correct 31 ms 62952 KB Output is correct
12 Correct 31 ms 62932 KB Output is correct
13 Correct 32 ms 62836 KB Output is correct
14 Correct 32 ms 62952 KB Output is correct
15 Correct 30 ms 62828 KB Output is correct
16 Correct 30 ms 62960 KB Output is correct
17 Correct 30 ms 62888 KB Output is correct
18 Correct 31 ms 62940 KB Output is correct
19 Correct 32 ms 62844 KB Output is correct
20 Correct 31 ms 62924 KB Output is correct
21 Correct 30 ms 62932 KB Output is correct
22 Correct 31 ms 62920 KB Output is correct
23 Correct 31 ms 62924 KB Output is correct
24 Correct 33 ms 62880 KB Output is correct
25 Correct 32 ms 63028 KB Output is correct
26 Correct 32 ms 62900 KB Output is correct
27 Correct 32 ms 62956 KB Output is correct
28 Correct 30 ms 62932 KB Output is correct
29 Correct 30 ms 62924 KB Output is correct
30 Correct 30 ms 62840 KB Output is correct
31 Correct 33 ms 62952 KB Output is correct
32 Correct 30 ms 62924 KB Output is correct
33 Correct 30 ms 62952 KB Output is correct
34 Correct 33 ms 62952 KB Output is correct
35 Correct 29 ms 62924 KB Output is correct
36 Correct 30 ms 62868 KB Output is correct
37 Correct 30 ms 62836 KB Output is correct
38 Correct 30 ms 62956 KB Output is correct
39 Correct 31 ms 62932 KB Output is correct
40 Correct 31 ms 62932 KB Output is correct
41 Correct 30 ms 62876 KB Output is correct
42 Correct 34 ms 62884 KB Output is correct
43 Correct 39 ms 62916 KB Output is correct
44 Correct 34 ms 62932 KB Output is correct
45 Correct 31 ms 62828 KB Output is correct
46 Correct 31 ms 62932 KB Output is correct
47 Correct 33 ms 63000 KB Output is correct
48 Correct 30 ms 62976 KB Output is correct
49 Correct 31 ms 62924 KB Output is correct
50 Correct 32 ms 62980 KB Output is correct
51 Correct 35 ms 63056 KB Output is correct
52 Correct 35 ms 62924 KB Output is correct
53 Correct 32 ms 62988 KB Output is correct
54 Correct 34 ms 62996 KB Output is correct
55 Correct 31 ms 62928 KB Output is correct
56 Correct 31 ms 62956 KB Output is correct
57 Correct 30 ms 62904 KB Output is correct
58 Correct 30 ms 62920 KB Output is correct
59 Correct 32 ms 62932 KB Output is correct
60 Correct 30 ms 62936 KB Output is correct
61 Correct 37 ms 62924 KB Output is correct
62 Correct 30 ms 62924 KB Output is correct
63 Correct 30 ms 62916 KB Output is correct
64 Correct 31 ms 62996 KB Output is correct
65 Correct 31 ms 62992 KB Output is correct
66 Correct 45 ms 64564 KB Output is correct
67 Correct 42 ms 64520 KB Output is correct
68 Correct 40 ms 63944 KB Output is correct
69 Correct 56 ms 64528 KB Output is correct
70 Correct 43 ms 64724 KB Output is correct
71 Correct 49 ms 64776 KB Output is correct
72 Correct 44 ms 64460 KB Output is correct
73 Correct 41 ms 64040 KB Output is correct
74 Correct 44 ms 64744 KB Output is correct
75 Correct 41 ms 64680 KB Output is correct
76 Correct 42 ms 64296 KB Output is correct
77 Correct 44 ms 64832 KB Output is correct
78 Correct 45 ms 64152 KB Output is correct
79 Correct 40 ms 64212 KB Output is correct
80 Correct 40 ms 63900 KB Output is correct
81 Correct 41 ms 63828 KB Output is correct
82 Correct 50 ms 64912 KB Output is correct
83 Correct 43 ms 64732 KB Output is correct
84 Correct 45 ms 64964 KB Output is correct
85 Correct 41 ms 64920 KB Output is correct
86 Correct 37 ms 64776 KB Output is correct
87 Correct 36 ms 65032 KB Output is correct
88 Correct 37 ms 64676 KB Output is correct
89 Correct 38 ms 63744 KB Output is correct
90 Correct 38 ms 63768 KB Output is correct
91 Correct 615 ms 95060 KB Output is correct
92 Correct 823 ms 111904 KB Output is correct
93 Correct 791 ms 106716 KB Output is correct
94 Correct 743 ms 120928 KB Output is correct
95 Correct 799 ms 107708 KB Output is correct
96 Correct 718 ms 99228 KB Output is correct
97 Correct 724 ms 98976 KB Output is correct
98 Correct 808 ms 120528 KB Output is correct
99 Correct 714 ms 98904 KB Output is correct
100 Correct 782 ms 97932 KB Output is correct
101 Correct 675 ms 106428 KB Output is correct
102 Correct 716 ms 95900 KB Output is correct
103 Correct 620 ms 87516 KB Output is correct
104 Correct 643 ms 87520 KB Output is correct
105 Correct 678 ms 111056 KB Output is correct
106 Correct 811 ms 122204 KB Output is correct
107 Correct 1128 ms 108808 KB Output is correct
108 Correct 938 ms 121340 KB Output is correct
109 Correct 855 ms 122516 KB Output is correct
110 Correct 919 ms 120720 KB Output is correct
111 Correct 807 ms 109592 KB Output is correct
112 Correct 749 ms 103220 KB Output is correct
113 Correct 743 ms 101160 KB Output is correct
114 Correct 1173 ms 125348 KB Output is correct
115 Correct 850 ms 120780 KB Output is correct
116 Correct 719 ms 103116 KB Output is correct
117 Correct 822 ms 102008 KB Output is correct
118 Correct 905 ms 112396 KB Output is correct
119 Correct 725 ms 106280 KB Output is correct
120 Correct 721 ms 99256 KB Output is correct
121 Correct 692 ms 96552 KB Output is correct
122 Correct 686 ms 95508 KB Output is correct
123 Correct 756 ms 125076 KB Output is correct
124 Correct 785 ms 123580 KB Output is correct
125 Correct 264 ms 131032 KB Output is correct
126 Correct 331 ms 132112 KB Output is correct
127 Correct 346 ms 124332 KB Output is correct
128 Correct 402 ms 135316 KB Output is correct
129 Correct 332 ms 128244 KB Output is correct