답안 #838662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838662 2023-08-27T14:27:29 Z makrav Maze (JOI23_ho_t3) C++14
51 / 100
2000 ms 207172 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vei;
typedef vector<vei> vevei;

#define all(a) (a).begin(), (a).end()
#define sz(a) (int) a.size()
#define con cout << "NO\n"
#define coe cout << "YES\n";
#define str string
#define pb push_back
#define ff first
#define sc second
#define pii pair<int, int>
#define mxe max_element
#define mne min_element
#define stf shrink_to_fit
#define f(i, l, r) for (int i = (l); i < (r); i++)
#define double ld

vector<str> a;
vector<vector<pii>> comps;
vector<vector<int>> used;
int n, m;

void dfs(int i, int j) {
    used[i][j] = 1;
    comps.back().pb({ i, j });
    if (i - 1 >= 0 && a[i - 1][j] == '.' && !used[i - 1][j]) dfs(i - 1, j);
    if (i + 1 < n && a[i + 1][j] == '.' && !used[i + 1][j]) dfs(i + 1, j);
    if (j - 1 >= 0 && a[i][j - 1] == '.' && !used[i][j - 1]) dfs(i, j - 1);
    if (j + 1 < m && a[i][j + 1] == '.' && !used[i][j + 1]) dfs(i, j + 1);
}

struct node {
    int sm;
    node() = default;
    node(int a) {
        sm = a;
    }
};

struct segtree {
    int n;
    vector<int> a;
    vector<node> t;

    segtree() = default;
    segtree(int n_, vector<int> a_) {
        n = n_;
        a = a_;
        t.resize(4 * n);
        build(1, 0, n);
    }

    void build(int v, int tl, int tr) {
        if (tl + 1 == tr) {
            t[v] = node(a[tl]);
            return;
        }
        int tm = (tl + tr) / 2;
        build(v * 2, tl, tm);
        build(v * 2 + 1, tm, tr);
        t[v].sm = t[v * 2].sm + t[v * 2 + 1].sm;
    }

    void upd(int v, int tl, int tr, int pos, int val) {
        if (tl + 1 == tr) {
            t[v] = node(val);return;
        }
        int tm = (tl + tr) / 2;
        if (pos < tm) {
            upd(v * 2, tl, tm, pos, val);
        }
        else {
            upd(v * 2 + 1, tm, tr, pos, val);
        }
        t[v].sm = t[v * 2].sm + t[v * 2 + 1].sm;
    }

    pair<int, int> getkth(int v, int tl, int tr, int l, int r, int k) {
        if (tr <= l || tl >= r) return { -1, 0 };
        if (l <= tl && tr <= r) {
            if (t[v].sm < k) return { -1, t[v].sm };
            if (tl + 1 == tr) return { tl, t[v].sm };
            int tm = (tl + tr) / 2;
            if (t[v * 2].sm >= k) return getkth(v * 2, tl, tm, l, r, k);
            else return getkth(v * 2 + 1, tm, tr, l, r, k - t[v * 2].sm);
        }

        int tm = (tl + tr) / 2;
        pii lft = getkth(v * 2, tl, tm, l, r, k);
        if (lft.ff != -1) return lft;
        else return getkth(v * 2 + 1, tm, tr, l, r, k - lft.sc);
    }
};

bool check(pii a, pii b, int k) {
    return (max(abs(a.ff - b.ff), abs(a.sc - b.sc)) <= k && min(abs(a.ff - b.ff), abs(a.sc - b.sc)) <= k - 1);
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int k; cin >> n >> m >> k;
    pii s, g;
    cin >> s.ff >> s.sc >> g.ff >> g.sc;
    s.ff--; s.sc--; g.ff--; g.sc--;
    a.resize(n);
    used.assign(n, vector<int>(m, 0));
    f(i, 0, n) cin >> a[i];

    vector<vector<int>> comp(n, vector<int>(m, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == '.' && used[i][j] == 0) {
                comps.pb({});
                dfs(i, j);
                for (auto& u : comps.back()) {
                    comp[u.ff][u.sc] = sz(comps) - 1;
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == '#') {
                comps.pb({ {i, j} });
                comp[i][j] = sz(comps) - 1;
            }
        }
    }

    vector<vector<int>> dist(n, vector<int>(m, -1));
    vector<segtree> sg(n);
    vector<int> B(m, 1);
    f(i, 0, n) {
        sg[i] = segtree(m, B);
    }
    queue<pair<int, int>> q;
    for (auto& u : comps[comp[s.ff][s.sc]]) {
        q.push(u);
        dist[u.ff][u.sc] = 0;
        sg[u.ff].upd(1, 0, m, u.sc, 0);
    }

    while (!q.empty()) {
        auto [i, j] = q.front();
        q.pop();
        int curd = dist[i][j];
        if (k == 1) {
            for (int i1 = i - 2; i1 <= i + 2; i1++) {
                for (int j1 = j - (2 - abs(i - i1)); j1 <= j + abs(2 - abs(i - i1)); j1++) {
                    if (0 <= i1 && i1 < n && 0 <= j1 && j1 < m) {
                        if ((!check({ i, j }, { i1, j1 }, k) && a[i1][j1] == '#') || dist[i1][j1] != -1) continue;
                        for (auto& u : comps[comp[i1][j1]]) {
                            dist[u.ff][u.sc] = curd + 1;
                            q.push(u);
                        }
                    }
                }
            }
        }
        else {
            for (int row = max(0, i - k - 1); row <= min(n - 1, i + k + 1); row++) {
                int l = max(0, j - k - 1), r = min(m - 1, j + k + 1) + 1;
                if (row == i - k - 1 || row == i + k + 1) {
                    l = max(0, j - k + 1);
                    r = min(m - 1, j + k - 1) + 1;
                }
                if (row == i - k || row == i + k) {
                    l = max(0, j - k);
                    r = min(m - 1, j + k) + 1;
                }
                int K = 1;
                int nw = sg[row].getkth(1, 0, m, l, r, K).ff;
                while (nw != -1) {
                    if (!check({ i, j }, { row, nw }, k) && a[row][nw] == '#') {
                        K++;
                        nw = sg[row].getkth(1, 0, m, l, r, K).ff;
                        continue;
                    }
                    for (auto& u : comps[comp[row][nw]]) {
                        dist[u.ff][u.sc] = curd + 1;
                        q.push(u);
                        sg[u.ff].upd(1, 0, m, u.sc, 0);
                    }
                    nw = sg[row].getkth(1, 0, m, l, r, K).ff;
                }
            }
        }
    }
    cout << dist[g.ff][g.sc] << '\n';

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:155:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  155 |         auto [i, j] = q.front();
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 10 ms 5384 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 10 ms 8272 KB Output is correct
22 Correct 13 ms 4744 KB Output is correct
23 Correct 10 ms 5512 KB Output is correct
24 Correct 5 ms 3492 KB Output is correct
25 Correct 7 ms 5984 KB Output is correct
26 Correct 13 ms 4628 KB Output is correct
27 Correct 13 ms 4872 KB Output is correct
28 Correct 10 ms 5640 KB Output is correct
29 Correct 27 ms 13184 KB Output is correct
30 Correct 10 ms 5316 KB Output is correct
31 Correct 28 ms 21428 KB Output is correct
32 Correct 33 ms 11524 KB Output is correct
33 Correct 27 ms 13440 KB Output is correct
34 Correct 12 ms 8080 KB Output is correct
35 Correct 18 ms 14500 KB Output is correct
36 Correct 39 ms 10792 KB Output is correct
37 Correct 38 ms 11648 KB Output is correct
38 Correct 28 ms 13508 KB Output is correct
39 Correct 379 ms 128764 KB Output is correct
40 Correct 36 ms 12036 KB Output is correct
41 Correct 20 ms 11896 KB Output is correct
42 Correct 45 ms 18432 KB Output is correct
43 Correct 39 ms 21368 KB Output is correct
44 Correct 140 ms 45688 KB Output is correct
45 Correct 149 ms 70776 KB Output is correct
46 Correct 332 ms 207172 KB Output is correct
47 Correct 386 ms 111388 KB Output is correct
48 Correct 426 ms 131340 KB Output is correct
49 Correct 124 ms 78408 KB Output is correct
50 Correct 193 ms 142596 KB Output is correct
51 Correct 353 ms 103444 KB Output is correct
52 Correct 384 ms 111888 KB Output is correct
53 Correct 357 ms 131516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 3 ms 468 KB Output is correct
25 Correct 33 ms 3212 KB Output is correct
26 Correct 59 ms 6024 KB Output is correct
27 Correct 11 ms 8316 KB Output is correct
28 Correct 106 ms 8720 KB Output is correct
29 Correct 103 ms 5300 KB Output is correct
30 Correct 104 ms 6024 KB Output is correct
31 Correct 323 ms 4744 KB Output is correct
32 Correct 12 ms 4616 KB Output is correct
33 Correct 13 ms 4872 KB Output is correct
34 Correct 986 ms 12368 KB Output is correct
35 Correct 29 ms 21476 KB Output is correct
36 Correct 403 ms 21676 KB Output is correct
37 Correct 401 ms 12704 KB Output is correct
38 Correct 389 ms 14628 KB Output is correct
39 Correct 1909 ms 41200 KB Output is correct
40 Execution timed out 2073 ms 120848 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 10 ms 5384 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 724 KB Output is correct
36 Correct 33 ms 3284 KB Output is correct
37 Correct 6 ms 4636 KB Output is correct
38 Correct 56 ms 6092 KB Output is correct
39 Correct 11 ms 8272 KB Output is correct
40 Correct 13 ms 4816 KB Output is correct
41 Correct 9 ms 5604 KB Output is correct
42 Correct 105 ms 8716 KB Output is correct
43 Correct 104 ms 5256 KB Output is correct
44 Correct 107 ms 6076 KB Output is correct
45 Correct 5 ms 3432 KB Output is correct
46 Correct 7 ms 5984 KB Output is correct
47 Correct 31 ms 5256 KB Output is correct
48 Correct 97 ms 4744 KB Output is correct
49 Correct 142 ms 4744 KB Output is correct
50 Correct 214 ms 4744 KB Output is correct
51 Correct 308 ms 4744 KB Output is correct
52 Correct 12 ms 4592 KB Output is correct
53 Correct 13 ms 4872 KB Output is correct
54 Correct 10 ms 5640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 10 ms 5384 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 724 KB Output is correct
36 Correct 33 ms 3284 KB Output is correct
37 Correct 6 ms 4636 KB Output is correct
38 Correct 56 ms 6092 KB Output is correct
39 Correct 11 ms 8272 KB Output is correct
40 Correct 13 ms 4816 KB Output is correct
41 Correct 9 ms 5604 KB Output is correct
42 Correct 105 ms 8716 KB Output is correct
43 Correct 104 ms 5256 KB Output is correct
44 Correct 107 ms 6076 KB Output is correct
45 Correct 5 ms 3432 KB Output is correct
46 Correct 7 ms 5984 KB Output is correct
47 Correct 31 ms 5256 KB Output is correct
48 Correct 97 ms 4744 KB Output is correct
49 Correct 142 ms 4744 KB Output is correct
50 Correct 214 ms 4744 KB Output is correct
51 Correct 308 ms 4744 KB Output is correct
52 Correct 12 ms 4592 KB Output is correct
53 Correct 13 ms 4872 KB Output is correct
54 Correct 10 ms 5640 KB Output is correct
55 Correct 26 ms 13184 KB Output is correct
56 Correct 10 ms 5384 KB Output is correct
57 Correct 936 ms 12436 KB Output is correct
58 Correct 142 ms 11096 KB Output is correct
59 Correct 29 ms 21472 KB Output is correct
60 Correct 32 ms 11524 KB Output is correct
61 Correct 26 ms 13396 KB Output is correct
62 Correct 405 ms 21712 KB Output is correct
63 Correct 398 ms 12676 KB Output is correct
64 Correct 421 ms 14720 KB Output is correct
65 Correct 12 ms 8196 KB Output is correct
66 Correct 19 ms 14476 KB Output is correct
67 Correct 76 ms 12672 KB Output is correct
68 Correct 338 ms 11520 KB Output is correct
69 Correct 508 ms 11396 KB Output is correct
70 Correct 764 ms 11496 KB Output is correct
71 Correct 1142 ms 11652 KB Output is correct
72 Correct 32 ms 10756 KB Output is correct
73 Correct 31 ms 11688 KB Output is correct
74 Correct 29 ms 13568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 10 ms 5384 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 10 ms 8272 KB Output is correct
22 Correct 13 ms 4744 KB Output is correct
23 Correct 10 ms 5512 KB Output is correct
24 Correct 5 ms 3492 KB Output is correct
25 Correct 7 ms 5984 KB Output is correct
26 Correct 13 ms 4628 KB Output is correct
27 Correct 13 ms 4872 KB Output is correct
28 Correct 10 ms 5640 KB Output is correct
29 Correct 27 ms 13184 KB Output is correct
30 Correct 10 ms 5316 KB Output is correct
31 Correct 28 ms 21428 KB Output is correct
32 Correct 33 ms 11524 KB Output is correct
33 Correct 27 ms 13440 KB Output is correct
34 Correct 12 ms 8080 KB Output is correct
35 Correct 18 ms 14500 KB Output is correct
36 Correct 39 ms 10792 KB Output is correct
37 Correct 38 ms 11648 KB Output is correct
38 Correct 28 ms 13508 KB Output is correct
39 Correct 379 ms 128764 KB Output is correct
40 Correct 36 ms 12036 KB Output is correct
41 Correct 20 ms 11896 KB Output is correct
42 Correct 45 ms 18432 KB Output is correct
43 Correct 39 ms 21368 KB Output is correct
44 Correct 140 ms 45688 KB Output is correct
45 Correct 149 ms 70776 KB Output is correct
46 Correct 332 ms 207172 KB Output is correct
47 Correct 386 ms 111388 KB Output is correct
48 Correct 426 ms 131340 KB Output is correct
49 Correct 124 ms 78408 KB Output is correct
50 Correct 193 ms 142596 KB Output is correct
51 Correct 353 ms 103444 KB Output is correct
52 Correct 384 ms 111888 KB Output is correct
53 Correct 357 ms 131516 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 468 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 468 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 0 ms 340 KB Output is correct
69 Correct 0 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 468 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 468 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 340 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 340 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 3 ms 468 KB Output is correct
110 Correct 33 ms 3212 KB Output is correct
111 Correct 59 ms 6024 KB Output is correct
112 Correct 11 ms 8316 KB Output is correct
113 Correct 106 ms 8720 KB Output is correct
114 Correct 103 ms 5300 KB Output is correct
115 Correct 104 ms 6024 KB Output is correct
116 Correct 323 ms 4744 KB Output is correct
117 Correct 12 ms 4616 KB Output is correct
118 Correct 13 ms 4872 KB Output is correct
119 Correct 986 ms 12368 KB Output is correct
120 Correct 29 ms 21476 KB Output is correct
121 Correct 403 ms 21676 KB Output is correct
122 Correct 401 ms 12704 KB Output is correct
123 Correct 389 ms 14628 KB Output is correct
124 Correct 1909 ms 41200 KB Output is correct
125 Execution timed out 2073 ms 120848 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 10 ms 5384 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 10 ms 8272 KB Output is correct
22 Correct 13 ms 4744 KB Output is correct
23 Correct 10 ms 5512 KB Output is correct
24 Correct 5 ms 3492 KB Output is correct
25 Correct 7 ms 5984 KB Output is correct
26 Correct 13 ms 4628 KB Output is correct
27 Correct 13 ms 4872 KB Output is correct
28 Correct 10 ms 5640 KB Output is correct
29 Correct 27 ms 13184 KB Output is correct
30 Correct 10 ms 5316 KB Output is correct
31 Correct 28 ms 21428 KB Output is correct
32 Correct 33 ms 11524 KB Output is correct
33 Correct 27 ms 13440 KB Output is correct
34 Correct 12 ms 8080 KB Output is correct
35 Correct 18 ms 14500 KB Output is correct
36 Correct 39 ms 10792 KB Output is correct
37 Correct 38 ms 11648 KB Output is correct
38 Correct 28 ms 13508 KB Output is correct
39 Correct 379 ms 128764 KB Output is correct
40 Correct 36 ms 12036 KB Output is correct
41 Correct 20 ms 11896 KB Output is correct
42 Correct 45 ms 18432 KB Output is correct
43 Correct 39 ms 21368 KB Output is correct
44 Correct 140 ms 45688 KB Output is correct
45 Correct 149 ms 70776 KB Output is correct
46 Correct 332 ms 207172 KB Output is correct
47 Correct 386 ms 111388 KB Output is correct
48 Correct 426 ms 131340 KB Output is correct
49 Correct 124 ms 78408 KB Output is correct
50 Correct 193 ms 142596 KB Output is correct
51 Correct 353 ms 103444 KB Output is correct
52 Correct 384 ms 111888 KB Output is correct
53 Correct 357 ms 131516 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 468 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 468 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 0 ms 340 KB Output is correct
69 Correct 0 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 468 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 468 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 340 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 340 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 3 ms 468 KB Output is correct
110 Correct 33 ms 3212 KB Output is correct
111 Correct 59 ms 6024 KB Output is correct
112 Correct 11 ms 8316 KB Output is correct
113 Correct 106 ms 8720 KB Output is correct
114 Correct 103 ms 5300 KB Output is correct
115 Correct 104 ms 6024 KB Output is correct
116 Correct 323 ms 4744 KB Output is correct
117 Correct 12 ms 4616 KB Output is correct
118 Correct 13 ms 4872 KB Output is correct
119 Correct 986 ms 12368 KB Output is correct
120 Correct 29 ms 21476 KB Output is correct
121 Correct 403 ms 21676 KB Output is correct
122 Correct 401 ms 12704 KB Output is correct
123 Correct 389 ms 14628 KB Output is correct
124 Correct 1909 ms 41200 KB Output is correct
125 Execution timed out 2073 ms 120848 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 10 ms 5384 KB Output is correct
20 Correct 6 ms 4688 KB Output is correct
21 Correct 10 ms 8272 KB Output is correct
22 Correct 13 ms 4744 KB Output is correct
23 Correct 10 ms 5512 KB Output is correct
24 Correct 5 ms 3492 KB Output is correct
25 Correct 7 ms 5984 KB Output is correct
26 Correct 13 ms 4628 KB Output is correct
27 Correct 13 ms 4872 KB Output is correct
28 Correct 10 ms 5640 KB Output is correct
29 Correct 27 ms 13184 KB Output is correct
30 Correct 10 ms 5316 KB Output is correct
31 Correct 28 ms 21428 KB Output is correct
32 Correct 33 ms 11524 KB Output is correct
33 Correct 27 ms 13440 KB Output is correct
34 Correct 12 ms 8080 KB Output is correct
35 Correct 18 ms 14500 KB Output is correct
36 Correct 39 ms 10792 KB Output is correct
37 Correct 38 ms 11648 KB Output is correct
38 Correct 28 ms 13508 KB Output is correct
39 Correct 379 ms 128764 KB Output is correct
40 Correct 36 ms 12036 KB Output is correct
41 Correct 20 ms 11896 KB Output is correct
42 Correct 45 ms 18432 KB Output is correct
43 Correct 39 ms 21368 KB Output is correct
44 Correct 140 ms 45688 KB Output is correct
45 Correct 149 ms 70776 KB Output is correct
46 Correct 332 ms 207172 KB Output is correct
47 Correct 386 ms 111388 KB Output is correct
48 Correct 426 ms 131340 KB Output is correct
49 Correct 124 ms 78408 KB Output is correct
50 Correct 193 ms 142596 KB Output is correct
51 Correct 353 ms 103444 KB Output is correct
52 Correct 384 ms 111888 KB Output is correct
53 Correct 357 ms 131516 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 468 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 468 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 0 ms 340 KB Output is correct
69 Correct 0 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 340 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 468 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 468 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 1 ms 340 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 340 KB Output is correct
102 Correct 0 ms 340 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 3 ms 468 KB Output is correct
110 Correct 33 ms 3212 KB Output is correct
111 Correct 59 ms 6024 KB Output is correct
112 Correct 11 ms 8316 KB Output is correct
113 Correct 106 ms 8720 KB Output is correct
114 Correct 103 ms 5300 KB Output is correct
115 Correct 104 ms 6024 KB Output is correct
116 Correct 323 ms 4744 KB Output is correct
117 Correct 12 ms 4616 KB Output is correct
118 Correct 13 ms 4872 KB Output is correct
119 Correct 986 ms 12368 KB Output is correct
120 Correct 29 ms 21476 KB Output is correct
121 Correct 403 ms 21676 KB Output is correct
122 Correct 401 ms 12704 KB Output is correct
123 Correct 389 ms 14628 KB Output is correct
124 Correct 1909 ms 41200 KB Output is correct
125 Execution timed out 2073 ms 120848 KB Time limit exceeded
126 Halted 0 ms 0 KB -