답안 #292003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292003 2020-09-06T07:30:53 Z Diuven 로봇 골프 (ROI19_golf) C++11
100 / 100
1705 ms 65556 KB
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef gp_hash_table<int, int> table;

const int INF = 1000 * 1000 * 1000 + 21;
const ll LLINF = (1ll << 60) + 5;
const int MOD = 998244353;

const int MAX_N = 1000 * 1000 + 228;

struct point {
    int x;
    int y;
};

bool operator<(const point& a, const point& b) {
    return a.x + a.y > b.x + b.y || (a.x + a.y == b.x + b.y && a.x - a.y < b.x - b.y);
}

bool operator==(const point& a, const point& b) {
    return a.x == b.x && a.y == b.y;
}

ll n, m;
int k;
map<pair<int, int>, int> costs;
vector<point> points[2];
vector<int> diags[2];
table dp;

inline int calc_cost(int x, int ptr1, int ptr2, map<pair<int, int>, int>::iterator it) {
    if (x == n - 1) {
        return 0;
    } else if (it != costs.end()) {
        return it->second;
    } else {
        int ans = -INF;
        if (1 <= ptr1 && ptr1 <= n + n - 1) {
            ans = max(ans, dp[ptr1]);
        } else {
            ans = max(ans, 0);
        }
        if (1 <= ptr2 && ptr2 <= n + n - 1) {
            ans = max(ans, dp[ptr2]);
        } else {
            ans = max(ans, 0);
        }

        return ans;
    }
}

int main() {
#ifdef CH_EGOR
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#else
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
#endif

    scanf("%lld%lld%d", &n, &m, &k);
    n = max(n, m); // magic

    for (int i = -2; i <= k; ++i) {
        int x, y, c;
        if (i == -2) {
            x = 0;
            y = 1;
            c = 0;
        } else if (i == -1) {
            x = 1;
            y = 0;
            c = 0;
        } else if (i == 0) {
            x = 0;
            y = 0;
            c = 0;
        } else {
            scanf("%d%d%d", &x, &y, &c);
            --x; --y;
            costs[{x, y}] = c;
        }
        for (int dx = 0; dx <= 2; ++dx) {
            for (int dy = 0; dy <= 2; ++dy) {
                int gox = x - dx;
                int goy = y - dy;
                if (gox >= 0 && goy >= 0 && dx + dy <= 2) {
                    points[(gox + goy) & 1].push_back({gox, goy});
                    diags[(gox + goy) & 1].push_back(gox + goy);

                    if (gox - goy >= 2) {
                        points[(gox + goy) & 1].push_back({gox - goy - 2, 0});
                        diags[(gox + goy) & 1].push_back({gox - goy - 2});
                    } else if (gox - goy <= -2) {
                        points[(gox + goy) & 1].push_back({0, goy - gox - 2});
                        diags[(gox + goy) & 1].push_back(goy - gox - 2);
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < 2; ++i) {
        dp.clear();
        sort(points[i].begin(), points[i].end());
        points[i].resize(unique(points[i].begin(), points[i].end()) - points[i].begin());
        sort(diags[i].begin(), diags[i].end());
        diags[i].resize(unique(diags[i].begin(), diags[i].end()) - diags[i].begin());
        reverse(diags[i].begin(), diags[i].end());

        int cur_add = 0;
        int points_ptr = 0;
        for (int j = 0; j < (int)diags[i].size(); ++j) {
            int lf = 0;
            int rf = 0;

            if (diags[i][j] >= n - 1) {
                lf = n - ((n + n - 2) - diags[i][j]);
                rf = n + ((n + n - 2) - diags[i][j]);
            } else {
                lf = n - diags[i][j];
                rf = n + diags[i][j];
            }

            if (j != 0) {
                ans = (ans + (ll)(diags[i][j - 1] - diags[i][j] - 1) / 2ll * cur_add) % MOD;
            }

            if (diags[i][j] < n - 1) {
                if (dp.find(lf - 2) != dp.end()) {
                    cur_add = (cur_add - dp[lf - 2]) % MOD;
                }
                if (dp.find(rf + 2) != dp.end()) {
                    cur_add = (cur_add - dp[rf + 2]) % MOD;
                }
            }

            vector<pair<int, int>> new_vals;
            for ( ;
                points_ptr < (int)points[i].size() && points[i][points_ptr].x + points[i][points_ptr].y >= diags[i][j];
                ++points_ptr) {

                int x = points[i][points_ptr].x;
                int y = points[i][points_ptr].y;

                auto it = costs.find({x, y});
                int rl_val = min(
                    it != costs.end() ? it->second : calc_cost(x, n + x - y + 2, n + x - y, costs.find({x + 1, y})),
                    it != costs.end() ? it->second : calc_cost(y, n + x - y - 2, n + x - y, costs.find({x, y + 1}))
                );

                if (lf <= n + x - y && n + x - y <= rf) {
                    new_vals.push_back({n + x - y, rl_val});
                }
            }

            for (int i = 0; i < (int)new_vals.size(); ++i) {
                cur_add = (cur_add - dp[new_vals[i].first]) % MOD;
                cur_add = (cur_add + new_vals[i].second) % MOD;
                dp[new_vals[i].first] = new_vals[i].second;
            }

            /*
            cerr << "Now " << diags[i][j] << endl;
            for (int i = lf; i <= rf; i += 2) {
                cerr << dp[i] << " ";
            }
            cerr << endl;
            */

            ans = (ans + cur_add) % MOD;
        }
    }

    if (ans < 0) {
        ans += MOD;
    }

    printf("%d\n", ans);

    return 0;
}

Compilation message

golf.cpp:22: warning: ignoring #pragma comment  [-Wunknown-pragmas]
   22 | #pragma comment(linker, "/STACK:256000000")
      | 
golf.cpp: In function 'int main()':
golf.cpp:87:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   87 |     scanf("%lld%lld%d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
golf.cpp:105:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  105 |             scanf("%d%d%d", &x, &y, &c);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 569 ms 24340 KB Output is correct
11 Correct 606 ms 24292 KB Output is correct
12 Correct 564 ms 24368 KB Output is correct
13 Correct 571 ms 24380 KB Output is correct
14 Correct 558 ms 24332 KB Output is correct
15 Correct 517 ms 24188 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 19 ms 1528 KB Output is correct
19 Correct 16 ms 1272 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 528 ms 24248 KB Output is correct
23 Correct 467 ms 24248 KB Output is correct
24 Correct 481 ms 24272 KB Output is correct
25 Correct 554 ms 24256 KB Output is correct
26 Correct 541 ms 24248 KB Output is correct
27 Correct 495 ms 24252 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 395 ms 24376 KB Output is correct
33 Correct 446 ms 24252 KB Output is correct
34 Correct 386 ms 24256 KB Output is correct
35 Correct 330 ms 24376 KB Output is correct
36 Correct 297 ms 24388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 106 ms 4440 KB Output is correct
4 Correct 462 ms 21912 KB Output is correct
5 Correct 679 ms 43420 KB Output is correct
6 Correct 865 ms 43460 KB Output is correct
7 Correct 794 ms 43548 KB Output is correct
8 Correct 481 ms 35800 KB Output is correct
9 Correct 630 ms 40620 KB Output is correct
10 Correct 738 ms 42200 KB Output is correct
11 Correct 747 ms 42952 KB Output is correct
12 Correct 815 ms 43592 KB Output is correct
13 Correct 889 ms 42904 KB Output is correct
14 Correct 955 ms 42700 KB Output is correct
15 Correct 642 ms 31272 KB Output is correct
16 Correct 695 ms 31316 KB Output is correct
17 Correct 1099 ms 43448 KB Output is correct
18 Correct 552 ms 31168 KB Output is correct
19 Correct 629 ms 24992 KB Output is correct
20 Correct 545 ms 25012 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 256 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 279 ms 23740 KB Output is correct
27 Correct 340 ms 24488 KB Output is correct
28 Correct 264 ms 24852 KB Output is correct
29 Correct 258 ms 24896 KB Output is correct
30 Correct 251 ms 24892 KB Output is correct
31 Correct 278 ms 24772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 17216 KB Output is correct
2 Correct 251 ms 17324 KB Output is correct
3 Correct 485 ms 25504 KB Output is correct
4 Correct 442 ms 25384 KB Output is correct
5 Correct 443 ms 24260 KB Output is correct
6 Correct 346 ms 21572 KB Output is correct
7 Correct 424 ms 24248 KB Output is correct
8 Correct 477 ms 24256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 569 ms 24340 KB Output is correct
11 Correct 606 ms 24292 KB Output is correct
12 Correct 564 ms 24368 KB Output is correct
13 Correct 571 ms 24380 KB Output is correct
14 Correct 558 ms 24332 KB Output is correct
15 Correct 517 ms 24188 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 19 ms 1528 KB Output is correct
19 Correct 16 ms 1272 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 528 ms 24248 KB Output is correct
23 Correct 467 ms 24248 KB Output is correct
24 Correct 481 ms 24272 KB Output is correct
25 Correct 554 ms 24256 KB Output is correct
26 Correct 541 ms 24248 KB Output is correct
27 Correct 495 ms 24252 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 395 ms 24376 KB Output is correct
33 Correct 446 ms 24252 KB Output is correct
34 Correct 386 ms 24256 KB Output is correct
35 Correct 330 ms 24376 KB Output is correct
36 Correct 297 ms 24388 KB Output is correct
37 Correct 595 ms 24248 KB Output is correct
38 Correct 584 ms 24384 KB Output is correct
39 Correct 582 ms 24252 KB Output is correct
40 Correct 550 ms 24256 KB Output is correct
41 Correct 528 ms 24420 KB Output is correct
42 Correct 470 ms 24256 KB Output is correct
43 Correct 477 ms 24248 KB Output is correct
44 Correct 441 ms 24248 KB Output is correct
45 Correct 526 ms 24248 KB Output is correct
46 Correct 540 ms 24252 KB Output is correct
47 Correct 7 ms 640 KB Output is correct
48 Correct 6 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 811 ms 28708 KB Output is correct
2 Correct 729 ms 26540 KB Output is correct
3 Correct 674 ms 26280 KB Output is correct
4 Correct 659 ms 26156 KB Output is correct
5 Correct 37 ms 3300 KB Output is correct
6 Correct 81 ms 7392 KB Output is correct
7 Correct 500 ms 24640 KB Output is correct
8 Correct 485 ms 24772 KB Output is correct
9 Correct 722 ms 25640 KB Output is correct
10 Correct 546 ms 24256 KB Output is correct
11 Correct 745 ms 25496 KB Output is correct
12 Correct 673 ms 25500 KB Output is correct
13 Correct 854 ms 25508 KB Output is correct
14 Correct 692 ms 25644 KB Output is correct
15 Correct 699 ms 24252 KB Output is correct
16 Correct 475 ms 24252 KB Output is correct
17 Correct 877 ms 24248 KB Output is correct
18 Correct 493 ms 25640 KB Output is correct
19 Correct 515 ms 24376 KB Output is correct
20 Correct 909 ms 24512 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 375 ms 24328 KB Output is correct
23 Correct 419 ms 24256 KB Output is correct
24 Correct 495 ms 24252 KB Output is correct
25 Correct 71 ms 4072 KB Output is correct
26 Correct 94 ms 6372 KB Output is correct
27 Correct 109 ms 7000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 811 ms 28708 KB Output is correct
2 Correct 729 ms 26540 KB Output is correct
3 Correct 674 ms 26280 KB Output is correct
4 Correct 659 ms 26156 KB Output is correct
5 Correct 37 ms 3300 KB Output is correct
6 Correct 81 ms 7392 KB Output is correct
7 Correct 500 ms 24640 KB Output is correct
8 Correct 485 ms 24772 KB Output is correct
9 Correct 722 ms 25640 KB Output is correct
10 Correct 546 ms 24256 KB Output is correct
11 Correct 745 ms 25496 KB Output is correct
12 Correct 673 ms 25500 KB Output is correct
13 Correct 854 ms 25508 KB Output is correct
14 Correct 692 ms 25644 KB Output is correct
15 Correct 699 ms 24252 KB Output is correct
16 Correct 475 ms 24252 KB Output is correct
17 Correct 877 ms 24248 KB Output is correct
18 Correct 493 ms 25640 KB Output is correct
19 Correct 515 ms 24376 KB Output is correct
20 Correct 909 ms 24512 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 375 ms 24328 KB Output is correct
23 Correct 419 ms 24256 KB Output is correct
24 Correct 495 ms 24252 KB Output is correct
25 Correct 71 ms 4072 KB Output is correct
26 Correct 94 ms 6372 KB Output is correct
27 Correct 109 ms 7000 KB Output is correct
28 Correct 1112 ms 63980 KB Output is correct
29 Correct 961 ms 44968 KB Output is correct
30 Correct 865 ms 44584 KB Output is correct
31 Correct 1138 ms 63984 KB Output is correct
32 Correct 987 ms 65556 KB Output is correct
33 Correct 682 ms 24400 KB Output is correct
34 Correct 587 ms 24284 KB Output is correct
35 Correct 663 ms 24248 KB Output is correct
36 Correct 772 ms 27060 KB Output is correct
37 Correct 512 ms 24380 KB Output is correct
38 Correct 1705 ms 24520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 569 ms 24340 KB Output is correct
11 Correct 606 ms 24292 KB Output is correct
12 Correct 564 ms 24368 KB Output is correct
13 Correct 571 ms 24380 KB Output is correct
14 Correct 558 ms 24332 KB Output is correct
15 Correct 517 ms 24188 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 19 ms 1528 KB Output is correct
19 Correct 16 ms 1272 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 528 ms 24248 KB Output is correct
23 Correct 467 ms 24248 KB Output is correct
24 Correct 481 ms 24272 KB Output is correct
25 Correct 554 ms 24256 KB Output is correct
26 Correct 541 ms 24248 KB Output is correct
27 Correct 495 ms 24252 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 395 ms 24376 KB Output is correct
33 Correct 446 ms 24252 KB Output is correct
34 Correct 386 ms 24256 KB Output is correct
35 Correct 330 ms 24376 KB Output is correct
36 Correct 297 ms 24388 KB Output is correct
37 Correct 249 ms 17216 KB Output is correct
38 Correct 251 ms 17324 KB Output is correct
39 Correct 485 ms 25504 KB Output is correct
40 Correct 442 ms 25384 KB Output is correct
41 Correct 443 ms 24260 KB Output is correct
42 Correct 346 ms 21572 KB Output is correct
43 Correct 424 ms 24248 KB Output is correct
44 Correct 477 ms 24256 KB Output is correct
45 Correct 1 ms 256 KB Output is correct
46 Correct 0 ms 256 KB Output is correct
47 Correct 811 ms 28708 KB Output is correct
48 Correct 729 ms 26540 KB Output is correct
49 Correct 674 ms 26280 KB Output is correct
50 Correct 659 ms 26156 KB Output is correct
51 Correct 37 ms 3300 KB Output is correct
52 Correct 81 ms 7392 KB Output is correct
53 Correct 500 ms 24640 KB Output is correct
54 Correct 485 ms 24772 KB Output is correct
55 Correct 722 ms 25640 KB Output is correct
56 Correct 546 ms 24256 KB Output is correct
57 Correct 745 ms 25496 KB Output is correct
58 Correct 673 ms 25500 KB Output is correct
59 Correct 854 ms 25508 KB Output is correct
60 Correct 692 ms 25644 KB Output is correct
61 Correct 699 ms 24252 KB Output is correct
62 Correct 475 ms 24252 KB Output is correct
63 Correct 877 ms 24248 KB Output is correct
64 Correct 493 ms 25640 KB Output is correct
65 Correct 515 ms 24376 KB Output is correct
66 Correct 909 ms 24512 KB Output is correct
67 Correct 1 ms 256 KB Output is correct
68 Correct 375 ms 24328 KB Output is correct
69 Correct 419 ms 24256 KB Output is correct
70 Correct 495 ms 24252 KB Output is correct
71 Correct 71 ms 4072 KB Output is correct
72 Correct 94 ms 6372 KB Output is correct
73 Correct 109 ms 7000 KB Output is correct
74 Correct 894 ms 27172 KB Output is correct
75 Correct 731 ms 26540 KB Output is correct
76 Correct 648 ms 26280 KB Output is correct
77 Correct 652 ms 26280 KB Output is correct
78 Correct 31 ms 3172 KB Output is correct
79 Correct 88 ms 7456 KB Output is correct
80 Correct 508 ms 24640 KB Output is correct
81 Correct 486 ms 24648 KB Output is correct
82 Correct 673 ms 24380 KB Output is correct
83 Correct 581 ms 25512 KB Output is correct
84 Correct 770 ms 25640 KB Output is correct
85 Correct 632 ms 24256 KB Output is correct
86 Correct 875 ms 25576 KB Output is correct
87 Correct 706 ms 24244 KB Output is correct
88 Correct 607 ms 24252 KB Output is correct
89 Correct 503 ms 24256 KB Output is correct
90 Correct 522 ms 24252 KB Output is correct
91 Correct 515 ms 25628 KB Output is correct
92 Correct 527 ms 24384 KB Output is correct
93 Correct 737 ms 24380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1024 KB Output is correct
2 Correct 7 ms 900 KB Output is correct
3 Correct 7 ms 900 KB Output is correct
4 Correct 7 ms 900 KB Output is correct
5 Correct 7 ms 1000 KB Output is correct
6 Correct 8 ms 896 KB Output is correct
7 Correct 7 ms 900 KB Output is correct
8 Correct 8 ms 904 KB Output is correct
9 Correct 7 ms 896 KB Output is correct
10 Correct 7 ms 896 KB Output is correct
11 Correct 7 ms 640 KB Output is correct
12 Correct 7 ms 600 KB Output is correct
13 Correct 8 ms 640 KB Output is correct
14 Correct 5 ms 640 KB Output is correct
15 Correct 7 ms 512 KB Output is correct
16 Correct 9 ms 512 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 3 ms 512 KB Output is correct
20 Correct 5 ms 604 KB Output is correct
21 Correct 6 ms 512 KB Output is correct
22 Correct 3 ms 512 KB Output is correct
23 Correct 3 ms 512 KB Output is correct
24 Correct 3 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 569 ms 24340 KB Output is correct
11 Correct 606 ms 24292 KB Output is correct
12 Correct 564 ms 24368 KB Output is correct
13 Correct 571 ms 24380 KB Output is correct
14 Correct 558 ms 24332 KB Output is correct
15 Correct 517 ms 24188 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 19 ms 1528 KB Output is correct
19 Correct 16 ms 1272 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 5 ms 512 KB Output is correct
22 Correct 528 ms 24248 KB Output is correct
23 Correct 467 ms 24248 KB Output is correct
24 Correct 481 ms 24272 KB Output is correct
25 Correct 554 ms 24256 KB Output is correct
26 Correct 541 ms 24248 KB Output is correct
27 Correct 495 ms 24252 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 395 ms 24376 KB Output is correct
33 Correct 446 ms 24252 KB Output is correct
34 Correct 386 ms 24256 KB Output is correct
35 Correct 330 ms 24376 KB Output is correct
36 Correct 297 ms 24388 KB Output is correct
37 Correct 249 ms 17216 KB Output is correct
38 Correct 251 ms 17324 KB Output is correct
39 Correct 485 ms 25504 KB Output is correct
40 Correct 442 ms 25384 KB Output is correct
41 Correct 443 ms 24260 KB Output is correct
42 Correct 346 ms 21572 KB Output is correct
43 Correct 424 ms 24248 KB Output is correct
44 Correct 477 ms 24256 KB Output is correct
45 Correct 1 ms 256 KB Output is correct
46 Correct 0 ms 256 KB Output is correct
47 Correct 0 ms 256 KB Output is correct
48 Correct 1 ms 384 KB Output is correct
49 Correct 106 ms 4440 KB Output is correct
50 Correct 462 ms 21912 KB Output is correct
51 Correct 679 ms 43420 KB Output is correct
52 Correct 865 ms 43460 KB Output is correct
53 Correct 794 ms 43548 KB Output is correct
54 Correct 481 ms 35800 KB Output is correct
55 Correct 630 ms 40620 KB Output is correct
56 Correct 738 ms 42200 KB Output is correct
57 Correct 747 ms 42952 KB Output is correct
58 Correct 815 ms 43592 KB Output is correct
59 Correct 889 ms 42904 KB Output is correct
60 Correct 955 ms 42700 KB Output is correct
61 Correct 642 ms 31272 KB Output is correct
62 Correct 695 ms 31316 KB Output is correct
63 Correct 1099 ms 43448 KB Output is correct
64 Correct 552 ms 31168 KB Output is correct
65 Correct 629 ms 24992 KB Output is correct
66 Correct 545 ms 25012 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 1 ms 384 KB Output is correct
69 Correct 1 ms 384 KB Output is correct
70 Correct 1 ms 256 KB Output is correct
71 Correct 1 ms 256 KB Output is correct
72 Correct 279 ms 23740 KB Output is correct
73 Correct 340 ms 24488 KB Output is correct
74 Correct 264 ms 24852 KB Output is correct
75 Correct 258 ms 24896 KB Output is correct
76 Correct 251 ms 24892 KB Output is correct
77 Correct 278 ms 24772 KB Output is correct
78 Correct 595 ms 24248 KB Output is correct
79 Correct 584 ms 24384 KB Output is correct
80 Correct 582 ms 24252 KB Output is correct
81 Correct 550 ms 24256 KB Output is correct
82 Correct 528 ms 24420 KB Output is correct
83 Correct 470 ms 24256 KB Output is correct
84 Correct 477 ms 24248 KB Output is correct
85 Correct 441 ms 24248 KB Output is correct
86 Correct 526 ms 24248 KB Output is correct
87 Correct 540 ms 24252 KB Output is correct
88 Correct 7 ms 640 KB Output is correct
89 Correct 6 ms 640 KB Output is correct
90 Correct 811 ms 28708 KB Output is correct
91 Correct 729 ms 26540 KB Output is correct
92 Correct 674 ms 26280 KB Output is correct
93 Correct 659 ms 26156 KB Output is correct
94 Correct 37 ms 3300 KB Output is correct
95 Correct 81 ms 7392 KB Output is correct
96 Correct 500 ms 24640 KB Output is correct
97 Correct 485 ms 24772 KB Output is correct
98 Correct 722 ms 25640 KB Output is correct
99 Correct 546 ms 24256 KB Output is correct
100 Correct 745 ms 25496 KB Output is correct
101 Correct 673 ms 25500 KB Output is correct
102 Correct 854 ms 25508 KB Output is correct
103 Correct 692 ms 25644 KB Output is correct
104 Correct 699 ms 24252 KB Output is correct
105 Correct 475 ms 24252 KB Output is correct
106 Correct 877 ms 24248 KB Output is correct
107 Correct 493 ms 25640 KB Output is correct
108 Correct 515 ms 24376 KB Output is correct
109 Correct 909 ms 24512 KB Output is correct
110 Correct 1 ms 256 KB Output is correct
111 Correct 375 ms 24328 KB Output is correct
112 Correct 419 ms 24256 KB Output is correct
113 Correct 495 ms 24252 KB Output is correct
114 Correct 71 ms 4072 KB Output is correct
115 Correct 94 ms 6372 KB Output is correct
116 Correct 109 ms 7000 KB Output is correct
117 Correct 1112 ms 63980 KB Output is correct
118 Correct 961 ms 44968 KB Output is correct
119 Correct 865 ms 44584 KB Output is correct
120 Correct 1138 ms 63984 KB Output is correct
121 Correct 987 ms 65556 KB Output is correct
122 Correct 682 ms 24400 KB Output is correct
123 Correct 587 ms 24284 KB Output is correct
124 Correct 663 ms 24248 KB Output is correct
125 Correct 772 ms 27060 KB Output is correct
126 Correct 512 ms 24380 KB Output is correct
127 Correct 1705 ms 24520 KB Output is correct
128 Correct 894 ms 27172 KB Output is correct
129 Correct 731 ms 26540 KB Output is correct
130 Correct 648 ms 26280 KB Output is correct
131 Correct 652 ms 26280 KB Output is correct
132 Correct 31 ms 3172 KB Output is correct
133 Correct 88 ms 7456 KB Output is correct
134 Correct 508 ms 24640 KB Output is correct
135 Correct 486 ms 24648 KB Output is correct
136 Correct 673 ms 24380 KB Output is correct
137 Correct 581 ms 25512 KB Output is correct
138 Correct 770 ms 25640 KB Output is correct
139 Correct 632 ms 24256 KB Output is correct
140 Correct 875 ms 25576 KB Output is correct
141 Correct 706 ms 24244 KB Output is correct
142 Correct 607 ms 24252 KB Output is correct
143 Correct 503 ms 24256 KB Output is correct
144 Correct 522 ms 24252 KB Output is correct
145 Correct 515 ms 25628 KB Output is correct
146 Correct 527 ms 24384 KB Output is correct
147 Correct 737 ms 24380 KB Output is correct
148 Correct 7 ms 1024 KB Output is correct
149 Correct 7 ms 900 KB Output is correct
150 Correct 7 ms 900 KB Output is correct
151 Correct 7 ms 900 KB Output is correct
152 Correct 7 ms 1000 KB Output is correct
153 Correct 8 ms 896 KB Output is correct
154 Correct 7 ms 900 KB Output is correct
155 Correct 8 ms 904 KB Output is correct
156 Correct 7 ms 896 KB Output is correct
157 Correct 7 ms 896 KB Output is correct
158 Correct 7 ms 640 KB Output is correct
159 Correct 7 ms 600 KB Output is correct
160 Correct 8 ms 640 KB Output is correct
161 Correct 5 ms 640 KB Output is correct
162 Correct 7 ms 512 KB Output is correct
163 Correct 9 ms 512 KB Output is correct
164 Correct 0 ms 256 KB Output is correct
165 Correct 0 ms 256 KB Output is correct
166 Correct 3 ms 512 KB Output is correct
167 Correct 5 ms 604 KB Output is correct
168 Correct 6 ms 512 KB Output is correct
169 Correct 3 ms 512 KB Output is correct
170 Correct 3 ms 512 KB Output is correct
171 Correct 3 ms 512 KB Output is correct
172 Correct 1154 ms 64124 KB Output is correct
173 Correct 985 ms 44964 KB Output is correct
174 Correct 940 ms 44732 KB Output is correct
175 Correct 919 ms 44612 KB Output is correct
176 Correct 906 ms 64084 KB Output is correct
177 Correct 1223 ms 64004 KB Output is correct
178 Correct 699 ms 24248 KB Output is correct
179 Correct 515 ms 24248 KB Output is correct
180 Correct 1016 ms 24264 KB Output is correct
181 Correct 769 ms 27184 KB Output is correct
182 Correct 491 ms 24500 KB Output is correct
183 Correct 1505 ms 24576 KB Output is correct