답안 #780312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
780312 2023-07-12T08:11:49 Z boris_mihov Maze (JOI23_ho_t3) C++17
51 / 100
2000 ms 671448 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <queue>

typedef long long llong;
const int MAXLOG = 23;
const int MAXN = 6000000 + 10;
const int INF  = 1e9;

struct BIT
{
    std::vector <int> tree;
    void build(int sz)
    {
        tree.resize(sz + 1, 0);
    }

    void update(int pos, int value)
    {
        assert(pos >= 1 && pos < (int)tree.size());
        for (int idx = pos ; idx < (int)tree.size() ; idx += idx & (-idx))
        {
            tree[idx] += value;
        }
    }

    int query(int pos)
    {
        assert(pos >= 0 && pos < (int)tree.size());
        int res = 0;
        for (int idx = pos ; idx > 0 ; idx -= idx & (-idx))
        {
            res += tree[idx];
        }

        return pos - res;
    }

    int findKth(int k)
    {
        int k2 = k;
        int idx = 0;
        for (int log = MAXLOG - 1 ; log >= 0 ; --log)
        {
            if (idx + (1 << log) < (int)tree.size() && (1 << log) - tree[idx + (1 << log)] < k)
            {
                idx += (1 << log);
                k -= (1 << log) - tree[idx];
            }
        }

        int l = 0, r = (int)tree.size(), mid;
        while (l < r - 1)
        {
            mid = (l + r) / 2;
            if (query(mid) < k2) l = mid;
            else r = mid;
        }

        // if (l != idx)
        // {
        //     std::cout << "bad: " << l << ' ' << idx << '\n' << std::flush;
        // }
        // assert(l == idx);
        return r;
    }
};

int r, c, n;
int sRow, sCol;
int eRow, eCol;
BIT byROW[MAXN];
BIT byCOL[MAXN];
std::pair <int,int> delta[] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
std::deque <std::pair <int,int>> dq;
std::vector <int> dist[MAXN];
std::string t[MAXN];

bool isOutside(int row, int col)
{
    return row == 0 || row == r + 1 || col == 0 || col == c + 1;
}

void setCELL(int row, int col)
{
    byROW[row].update(col, 1); 
    byCOL[col].update(row, 1); 
}

void addROW(int row, int colL, int colR, int currDist)
{
    int curr = byROW[row].query(colL - 1);
    // while (true)
    // {
    //     int search = byROW[row].findKth(curr + 1);
    //     if (search > colR)
    //     {
    //         break;
    //     }

    //     if (dist[row][search] > currDist + 1) dist[row][search] = currDist + 1;
    //     dq.push_back({row, search});
    //     setCELL(row, search);
    // }

    for (int i = colL ; i <= colR ; ++i)
    {
        if (dist[row][i] == INF)
        {
            if (byROW[row].findKth(curr + 1) != i)
            {
                // assert(false);
                int res = byROW[row].findKth(curr + 1); assert(res != i);
                // // assert(byROW[row].query(res) - byROW[row].query(res - 1) == 1);
                // bool was = (res > i);
                // assert(res >= 1 && res <= c);
                // while ((res < i) || (res > i));
                while (res < i);
                while (res > i);
                // assert(res == byROW[row].findKth(curr + 1));
                // assert(res != i && (res > i) == was);
                // // while (true) assert((res > i) == was);
            }

            setCELL(row, i);
            dist[row][i] = currDist + 1;
            dq.push_back({row, i});
        }
    }
}

void addCOL(int col, int rowL, int rowR, int currDist)
{
    int curr = byCOL[col].query(rowL - 1);
    // while (true)
    // {
    //     int search = byCOL[col].findKth(curr + 1);
    //     if (search > rowR)
    //     {
    //         break;
    //     }

    //     if (dist[search][col] > currDist + 1) dist[search][col] = currDist + 1;
    //     dq.push_back({search, col});
    //     setCELL(search, col);
    // }

    for (int i = rowL ; i <= rowR ; ++i)
    {
        if (dist[i][col] == INF)
        {
            if (byCOL[col].findKth(curr + 1) != i)
            {
                // assert(false);
                int res = byCOL[col].findKth(curr + 1); assert(res != i);
                // // assert(byCOL[col].query(res) - byCOL[col].query(res - 1) == 1);
                // bool was = (res > i);
                while (res < i){}
                while (res > i){}
                // assert(res != i && (res > i) == was);
                // // while (true) assert((res > i) == was);
            }

            setCELL(i, col);
            dist[i][col] = currDist + 1;
            dq.push_back({i, col});
        }
    }
}

void solve()
{
    for (int i = 1 ; i <= r ; ++i)
    {
        std::fill(dist[i].begin(), dist[i].end(), INF);
    }

    for (int i = 1 ; i <= r ; ++i)
    {
        byROW[i].build(c);
    }
    
    for (int i = 1 ; i <= c ; ++i)
    {
        byCOL[i].build(r);
    }
    
    dq.push_back({sRow, sCol});
    dist[sRow][sCol] = 0;
    setCELL(sRow, sCol);

    while (!dq.empty())
    {
        auto [row, col] = dq.front();
        dq.pop_front();    

        if (row == eRow && col == eCol)
        {
            std::cout << dist[row][col] << '\n';
            break;
        }

        for (const auto &[dx, dy] : delta)
        {
            if (isOutside(row + dx, col + dy) || dist[row + dx][col + dy] <= dist[row][col])
            {
                continue;
            }

            if (t[row + dx][col + dy] == '.')
            {
                setCELL(row + dx, col + dy);
                dist[row + dx][col + dy] = dist[row][col]; 
                dq.push_front({row + dx, col + dy});
            }
        }

        if (abs(row - eRow) <= n && abs(col - eCol) <= n && dist[eRow][eCol] > dist[row][col])
        {
            setCELL(eRow, eCol);
            dist[eRow][eCol] = dist[row][col] + 1;
            dq.push_back({eRow, eCol});
        }

        addROW(std::max(1, row - n), std::max(1, col - n + 1), std::min(c, col + n - 1), dist[row][col]);
        addROW(std::min(r, row + n), std::max(1, col - n + 1), std::min(c, col + n - 1), dist[row][col]);
        addCOL(std::max(1, col - n), std::max(1, row - n + 1), std::min(r, row + n - 1), dist[row][col]);
        addCOL(std::min(c, col + n), std::max(1, row - n + 1), std::min(r, row + n - 1), dist[row][col]);
    }
}

void input()
{
    std::cin >> r >> c >> n;
    std::cin >> sRow >> sCol;
    std::cin >> eRow >> eCol;
    for (int i = 1 ; i <= r ; ++i)
    {
        std::cin >> t[i];
        t[i] = ' ' + t[i];
        dist[i].resize(c + 1, INF);
    }
}

void fastIOI()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main()
{
    fastIOI();
    input();
    solve();

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 287 ms 610864 KB Output is correct
2 Correct 297 ms 610868 KB Output is correct
3 Correct 256 ms 610784 KB Output is correct
4 Correct 266 ms 610888 KB Output is correct
5 Correct 259 ms 610820 KB Output is correct
6 Correct 263 ms 610912 KB Output is correct
7 Correct 256 ms 610804 KB Output is correct
8 Correct 297 ms 610904 KB Output is correct
9 Correct 265 ms 610860 KB Output is correct
10 Correct 294 ms 610812 KB Output is correct
11 Correct 259 ms 610812 KB Output is correct
12 Correct 252 ms 610764 KB Output is correct
13 Correct 284 ms 610820 KB Output is correct
14 Correct 276 ms 610860 KB Output is correct
15 Correct 292 ms 610868 KB Output is correct
16 Correct 291 ms 610876 KB Output is correct
17 Correct 310 ms 610880 KB Output is correct
18 Correct 274 ms 610764 KB Output is correct
19 Correct 311 ms 611648 KB Output is correct
20 Correct 272 ms 612740 KB Output is correct
21 Correct 300 ms 611900 KB Output is correct
22 Correct 262 ms 611548 KB Output is correct
23 Correct 286 ms 611644 KB Output is correct
24 Correct 297 ms 613292 KB Output is correct
25 Correct 304 ms 613288 KB Output is correct
26 Correct 267 ms 611584 KB Output is correct
27 Correct 297 ms 611648 KB Output is correct
28 Correct 253 ms 611652 KB Output is correct
29 Correct 300 ms 612748 KB Output is correct
30 Correct 315 ms 612372 KB Output is correct
31 Correct 283 ms 613020 KB Output is correct
32 Correct 293 ms 612824 KB Output is correct
33 Correct 274 ms 612760 KB Output is correct
34 Correct 313 ms 616788 KB Output is correct
35 Correct 282 ms 616908 KB Output is correct
36 Correct 282 ms 612844 KB Output is correct
37 Correct 280 ms 612848 KB Output is correct
38 Correct 268 ms 612784 KB Output is correct
39 Correct 638 ms 630072 KB Output is correct
40 Correct 253 ms 613204 KB Output is correct
41 Correct 326 ms 618232 KB Output is correct
42 Correct 317 ms 613636 KB Output is correct
43 Correct 287 ms 616700 KB Output is correct
44 Correct 313 ms 623244 KB Output is correct
45 Correct 303 ms 622980 KB Output is correct
46 Correct 432 ms 636336 KB Output is correct
47 Correct 539 ms 630204 KB Output is correct
48 Correct 592 ms 630144 KB Output is correct
49 Correct 512 ms 671448 KB Output is correct
50 Correct 505 ms 671344 KB Output is correct
51 Correct 451 ms 630692 KB Output is correct
52 Correct 473 ms 630556 KB Output is correct
53 Correct 587 ms 630488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 610800 KB Output is correct
2 Correct 363 ms 610864 KB Output is correct
3 Correct 274 ms 610868 KB Output is correct
4 Correct 270 ms 610768 KB Output is correct
5 Correct 274 ms 610828 KB Output is correct
6 Correct 268 ms 610872 KB Output is correct
7 Correct 267 ms 610784 KB Output is correct
8 Correct 281 ms 610876 KB Output is correct
9 Correct 271 ms 610832 KB Output is correct
10 Correct 264 ms 610800 KB Output is correct
11 Correct 299 ms 610840 KB Output is correct
12 Correct 268 ms 610892 KB Output is correct
13 Correct 275 ms 610876 KB Output is correct
14 Correct 267 ms 610884 KB Output is correct
15 Correct 267 ms 610836 KB Output is correct
16 Correct 280 ms 610912 KB Output is correct
17 Correct 284 ms 610780 KB Output is correct
18 Correct 266 ms 610744 KB Output is correct
19 Correct 268 ms 610776 KB Output is correct
20 Correct 268 ms 610872 KB Output is correct
21 Correct 287 ms 610808 KB Output is correct
22 Correct 272 ms 610852 KB Output is correct
23 Correct 260 ms 610844 KB Output is correct
24 Correct 282 ms 610864 KB Output is correct
25 Correct 294 ms 610804 KB Output is correct
26 Correct 275 ms 610852 KB Output is correct
27 Correct 281 ms 610808 KB Output is correct
28 Correct 262 ms 610828 KB Output is correct
29 Correct 249 ms 610996 KB Output is correct
30 Correct 295 ms 610764 KB Output is correct
31 Correct 301 ms 610880 KB Output is correct
32 Correct 268 ms 610880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 259 ms 610868 KB Output is correct
2 Correct 268 ms 610864 KB Output is correct
3 Correct 261 ms 610868 KB Output is correct
4 Correct 274 ms 610828 KB Output is correct
5 Correct 276 ms 610816 KB Output is correct
6 Correct 267 ms 610896 KB Output is correct
7 Correct 283 ms 610824 KB Output is correct
8 Correct 287 ms 610968 KB Output is correct
9 Correct 283 ms 610808 KB Output is correct
10 Correct 274 ms 610800 KB Output is correct
11 Correct 277 ms 610848 KB Output is correct
12 Correct 275 ms 610792 KB Output is correct
13 Correct 275 ms 610760 KB Output is correct
14 Correct 281 ms 610896 KB Output is correct
15 Correct 274 ms 610776 KB Output is correct
16 Correct 276 ms 610900 KB Output is correct
17 Correct 280 ms 610880 KB Output is correct
18 Correct 279 ms 610872 KB Output is correct
19 Correct 276 ms 610872 KB Output is correct
20 Correct 275 ms 610764 KB Output is correct
21 Correct 279 ms 610876 KB Output is correct
22 Correct 277 ms 610804 KB Output is correct
23 Correct 270 ms 610880 KB Output is correct
24 Correct 279 ms 611024 KB Output is correct
25 Correct 280 ms 611364 KB Output is correct
26 Correct 282 ms 611924 KB Output is correct
27 Correct 297 ms 611964 KB Output is correct
28 Correct 280 ms 611720 KB Output is correct
29 Correct 288 ms 611796 KB Output is correct
30 Correct 280 ms 611708 KB Output is correct
31 Correct 301 ms 611696 KB Output is correct
32 Correct 286 ms 611728 KB Output is correct
33 Correct 292 ms 611688 KB Output is correct
34 Correct 317 ms 613624 KB Output is correct
35 Correct 288 ms 613124 KB Output is correct
36 Correct 441 ms 613580 KB Output is correct
37 Correct 278 ms 613032 KB Output is correct
38 Correct 275 ms 612912 KB Output is correct
39 Correct 393 ms 620860 KB Output is correct
40 Correct 551 ms 639028 KB Output is correct
41 Correct 395 ms 637152 KB Output is correct
42 Execution timed out 2085 ms 639100 KB Time limit exceeded
43 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 610800 KB Output is correct
2 Correct 363 ms 610864 KB Output is correct
3 Correct 274 ms 610868 KB Output is correct
4 Correct 270 ms 610768 KB Output is correct
5 Correct 274 ms 610828 KB Output is correct
6 Correct 268 ms 610872 KB Output is correct
7 Correct 267 ms 610784 KB Output is correct
8 Correct 281 ms 610876 KB Output is correct
9 Correct 271 ms 610832 KB Output is correct
10 Correct 264 ms 610800 KB Output is correct
11 Correct 299 ms 610840 KB Output is correct
12 Correct 268 ms 610892 KB Output is correct
13 Correct 275 ms 610876 KB Output is correct
14 Correct 267 ms 610884 KB Output is correct
15 Correct 267 ms 610836 KB Output is correct
16 Correct 280 ms 610912 KB Output is correct
17 Correct 284 ms 610780 KB Output is correct
18 Correct 266 ms 610744 KB Output is correct
19 Correct 268 ms 610776 KB Output is correct
20 Correct 268 ms 610872 KB Output is correct
21 Correct 287 ms 610808 KB Output is correct
22 Correct 272 ms 610852 KB Output is correct
23 Correct 260 ms 610844 KB Output is correct
24 Correct 282 ms 610864 KB Output is correct
25 Correct 294 ms 610804 KB Output is correct
26 Correct 275 ms 610852 KB Output is correct
27 Correct 281 ms 610808 KB Output is correct
28 Correct 262 ms 610828 KB Output is correct
29 Correct 249 ms 610996 KB Output is correct
30 Correct 295 ms 610764 KB Output is correct
31 Correct 301 ms 610880 KB Output is correct
32 Correct 268 ms 610880 KB Output is correct
33 Correct 294 ms 611740 KB Output is correct
34 Correct 274 ms 610780 KB Output is correct
35 Correct 284 ms 610940 KB Output is correct
36 Correct 280 ms 611364 KB Output is correct
37 Correct 278 ms 612744 KB Output is correct
38 Correct 277 ms 611868 KB Output is correct
39 Correct 278 ms 611944 KB Output is correct
40 Correct 286 ms 611712 KB Output is correct
41 Correct 280 ms 611680 KB Output is correct
42 Correct 274 ms 611688 KB Output is correct
43 Correct 267 ms 611712 KB Output is correct
44 Correct 273 ms 611784 KB Output is correct
45 Correct 273 ms 613324 KB Output is correct
46 Correct 275 ms 613280 KB Output is correct
47 Correct 284 ms 612360 KB Output is correct
48 Correct 275 ms 611664 KB Output is correct
49 Correct 281 ms 611752 KB Output is correct
50 Correct 275 ms 611724 KB Output is correct
51 Correct 278 ms 611716 KB Output is correct
52 Correct 268 ms 611652 KB Output is correct
53 Correct 272 ms 611660 KB Output is correct
54 Correct 273 ms 611760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 289 ms 610800 KB Output is correct
2 Correct 363 ms 610864 KB Output is correct
3 Correct 274 ms 610868 KB Output is correct
4 Correct 270 ms 610768 KB Output is correct
5 Correct 274 ms 610828 KB Output is correct
6 Correct 268 ms 610872 KB Output is correct
7 Correct 267 ms 610784 KB Output is correct
8 Correct 281 ms 610876 KB Output is correct
9 Correct 271 ms 610832 KB Output is correct
10 Correct 264 ms 610800 KB Output is correct
11 Correct 299 ms 610840 KB Output is correct
12 Correct 268 ms 610892 KB Output is correct
13 Correct 275 ms 610876 KB Output is correct
14 Correct 267 ms 610884 KB Output is correct
15 Correct 267 ms 610836 KB Output is correct
16 Correct 280 ms 610912 KB Output is correct
17 Correct 284 ms 610780 KB Output is correct
18 Correct 266 ms 610744 KB Output is correct
19 Correct 268 ms 610776 KB Output is correct
20 Correct 268 ms 610872 KB Output is correct
21 Correct 287 ms 610808 KB Output is correct
22 Correct 272 ms 610852 KB Output is correct
23 Correct 260 ms 610844 KB Output is correct
24 Correct 282 ms 610864 KB Output is correct
25 Correct 294 ms 610804 KB Output is correct
26 Correct 275 ms 610852 KB Output is correct
27 Correct 281 ms 610808 KB Output is correct
28 Correct 262 ms 610828 KB Output is correct
29 Correct 249 ms 610996 KB Output is correct
30 Correct 295 ms 610764 KB Output is correct
31 Correct 301 ms 610880 KB Output is correct
32 Correct 268 ms 610880 KB Output is correct
33 Correct 294 ms 611740 KB Output is correct
34 Correct 274 ms 610780 KB Output is correct
35 Correct 284 ms 610940 KB Output is correct
36 Correct 280 ms 611364 KB Output is correct
37 Correct 278 ms 612744 KB Output is correct
38 Correct 277 ms 611868 KB Output is correct
39 Correct 278 ms 611944 KB Output is correct
40 Correct 286 ms 611712 KB Output is correct
41 Correct 280 ms 611680 KB Output is correct
42 Correct 274 ms 611688 KB Output is correct
43 Correct 267 ms 611712 KB Output is correct
44 Correct 273 ms 611784 KB Output is correct
45 Correct 273 ms 613324 KB Output is correct
46 Correct 275 ms 613280 KB Output is correct
47 Correct 284 ms 612360 KB Output is correct
48 Correct 275 ms 611664 KB Output is correct
49 Correct 281 ms 611752 KB Output is correct
50 Correct 275 ms 611724 KB Output is correct
51 Correct 278 ms 611716 KB Output is correct
52 Correct 268 ms 611652 KB Output is correct
53 Correct 272 ms 611660 KB Output is correct
54 Correct 273 ms 611760 KB Output is correct
55 Correct 293 ms 612860 KB Output is correct
56 Correct 272 ms 612352 KB Output is correct
57 Correct 307 ms 613732 KB Output is correct
58 Correct 287 ms 612828 KB Output is correct
59 Correct 278 ms 613264 KB Output is correct
60 Correct 291 ms 612964 KB Output is correct
61 Correct 297 ms 612964 KB Output is correct
62 Correct 407 ms 613620 KB Output is correct
63 Correct 266 ms 612852 KB Output is correct
64 Correct 271 ms 612964 KB Output is correct
65 Correct 286 ms 617032 KB Output is correct
66 Correct 311 ms 617108 KB Output is correct
67 Correct 288 ms 614620 KB Output is correct
68 Correct 282 ms 613028 KB Output is correct
69 Correct 295 ms 613112 KB Output is correct
70 Correct 306 ms 613056 KB Output is correct
71 Correct 312 ms 613388 KB Output is correct
72 Correct 295 ms 612948 KB Output is correct
73 Correct 293 ms 613084 KB Output is correct
74 Correct 273 ms 612972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 287 ms 610864 KB Output is correct
2 Correct 297 ms 610868 KB Output is correct
3 Correct 256 ms 610784 KB Output is correct
4 Correct 266 ms 610888 KB Output is correct
5 Correct 259 ms 610820 KB Output is correct
6 Correct 263 ms 610912 KB Output is correct
7 Correct 256 ms 610804 KB Output is correct
8 Correct 297 ms 610904 KB Output is correct
9 Correct 265 ms 610860 KB Output is correct
10 Correct 294 ms 610812 KB Output is correct
11 Correct 259 ms 610812 KB Output is correct
12 Correct 252 ms 610764 KB Output is correct
13 Correct 284 ms 610820 KB Output is correct
14 Correct 276 ms 610860 KB Output is correct
15 Correct 292 ms 610868 KB Output is correct
16 Correct 291 ms 610876 KB Output is correct
17 Correct 310 ms 610880 KB Output is correct
18 Correct 274 ms 610764 KB Output is correct
19 Correct 311 ms 611648 KB Output is correct
20 Correct 272 ms 612740 KB Output is correct
21 Correct 300 ms 611900 KB Output is correct
22 Correct 262 ms 611548 KB Output is correct
23 Correct 286 ms 611644 KB Output is correct
24 Correct 297 ms 613292 KB Output is correct
25 Correct 304 ms 613288 KB Output is correct
26 Correct 267 ms 611584 KB Output is correct
27 Correct 297 ms 611648 KB Output is correct
28 Correct 253 ms 611652 KB Output is correct
29 Correct 300 ms 612748 KB Output is correct
30 Correct 315 ms 612372 KB Output is correct
31 Correct 283 ms 613020 KB Output is correct
32 Correct 293 ms 612824 KB Output is correct
33 Correct 274 ms 612760 KB Output is correct
34 Correct 313 ms 616788 KB Output is correct
35 Correct 282 ms 616908 KB Output is correct
36 Correct 282 ms 612844 KB Output is correct
37 Correct 280 ms 612848 KB Output is correct
38 Correct 268 ms 612784 KB Output is correct
39 Correct 638 ms 630072 KB Output is correct
40 Correct 253 ms 613204 KB Output is correct
41 Correct 326 ms 618232 KB Output is correct
42 Correct 317 ms 613636 KB Output is correct
43 Correct 287 ms 616700 KB Output is correct
44 Correct 313 ms 623244 KB Output is correct
45 Correct 303 ms 622980 KB Output is correct
46 Correct 432 ms 636336 KB Output is correct
47 Correct 539 ms 630204 KB Output is correct
48 Correct 592 ms 630144 KB Output is correct
49 Correct 512 ms 671448 KB Output is correct
50 Correct 505 ms 671344 KB Output is correct
51 Correct 451 ms 630692 KB Output is correct
52 Correct 473 ms 630556 KB Output is correct
53 Correct 587 ms 630488 KB Output is correct
54 Correct 289 ms 610800 KB Output is correct
55 Correct 363 ms 610864 KB Output is correct
56 Correct 274 ms 610868 KB Output is correct
57 Correct 270 ms 610768 KB Output is correct
58 Correct 274 ms 610828 KB Output is correct
59 Correct 268 ms 610872 KB Output is correct
60 Correct 267 ms 610784 KB Output is correct
61 Correct 281 ms 610876 KB Output is correct
62 Correct 271 ms 610832 KB Output is correct
63 Correct 264 ms 610800 KB Output is correct
64 Correct 299 ms 610840 KB Output is correct
65 Correct 268 ms 610892 KB Output is correct
66 Correct 275 ms 610876 KB Output is correct
67 Correct 267 ms 610884 KB Output is correct
68 Correct 267 ms 610836 KB Output is correct
69 Correct 280 ms 610912 KB Output is correct
70 Correct 284 ms 610780 KB Output is correct
71 Correct 266 ms 610744 KB Output is correct
72 Correct 268 ms 610776 KB Output is correct
73 Correct 268 ms 610872 KB Output is correct
74 Correct 287 ms 610808 KB Output is correct
75 Correct 272 ms 610852 KB Output is correct
76 Correct 260 ms 610844 KB Output is correct
77 Correct 282 ms 610864 KB Output is correct
78 Correct 294 ms 610804 KB Output is correct
79 Correct 275 ms 610852 KB Output is correct
80 Correct 281 ms 610808 KB Output is correct
81 Correct 262 ms 610828 KB Output is correct
82 Correct 249 ms 610996 KB Output is correct
83 Correct 295 ms 610764 KB Output is correct
84 Correct 301 ms 610880 KB Output is correct
85 Correct 268 ms 610880 KB Output is correct
86 Correct 259 ms 610868 KB Output is correct
87 Correct 268 ms 610864 KB Output is correct
88 Correct 261 ms 610868 KB Output is correct
89 Correct 274 ms 610828 KB Output is correct
90 Correct 276 ms 610816 KB Output is correct
91 Correct 267 ms 610896 KB Output is correct
92 Correct 283 ms 610824 KB Output is correct
93 Correct 287 ms 610968 KB Output is correct
94 Correct 283 ms 610808 KB Output is correct
95 Correct 274 ms 610800 KB Output is correct
96 Correct 277 ms 610848 KB Output is correct
97 Correct 275 ms 610792 KB Output is correct
98 Correct 275 ms 610760 KB Output is correct
99 Correct 281 ms 610896 KB Output is correct
100 Correct 274 ms 610776 KB Output is correct
101 Correct 276 ms 610900 KB Output is correct
102 Correct 280 ms 610880 KB Output is correct
103 Correct 279 ms 610872 KB Output is correct
104 Correct 276 ms 610872 KB Output is correct
105 Correct 275 ms 610764 KB Output is correct
106 Correct 279 ms 610876 KB Output is correct
107 Correct 277 ms 610804 KB Output is correct
108 Correct 270 ms 610880 KB Output is correct
109 Correct 279 ms 611024 KB Output is correct
110 Correct 280 ms 611364 KB Output is correct
111 Correct 282 ms 611924 KB Output is correct
112 Correct 297 ms 611964 KB Output is correct
113 Correct 280 ms 611720 KB Output is correct
114 Correct 288 ms 611796 KB Output is correct
115 Correct 280 ms 611708 KB Output is correct
116 Correct 301 ms 611696 KB Output is correct
117 Correct 286 ms 611728 KB Output is correct
118 Correct 292 ms 611688 KB Output is correct
119 Correct 317 ms 613624 KB Output is correct
120 Correct 288 ms 613124 KB Output is correct
121 Correct 441 ms 613580 KB Output is correct
122 Correct 278 ms 613032 KB Output is correct
123 Correct 275 ms 612912 KB Output is correct
124 Correct 393 ms 620860 KB Output is correct
125 Correct 551 ms 639028 KB Output is correct
126 Correct 395 ms 637152 KB Output is correct
127 Execution timed out 2085 ms 639100 KB Time limit exceeded
128 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 287 ms 610864 KB Output is correct
2 Correct 297 ms 610868 KB Output is correct
3 Correct 256 ms 610784 KB Output is correct
4 Correct 266 ms 610888 KB Output is correct
5 Correct 259 ms 610820 KB Output is correct
6 Correct 263 ms 610912 KB Output is correct
7 Correct 256 ms 610804 KB Output is correct
8 Correct 297 ms 610904 KB Output is correct
9 Correct 265 ms 610860 KB Output is correct
10 Correct 294 ms 610812 KB Output is correct
11 Correct 259 ms 610812 KB Output is correct
12 Correct 252 ms 610764 KB Output is correct
13 Correct 284 ms 610820 KB Output is correct
14 Correct 276 ms 610860 KB Output is correct
15 Correct 292 ms 610868 KB Output is correct
16 Correct 291 ms 610876 KB Output is correct
17 Correct 310 ms 610880 KB Output is correct
18 Correct 274 ms 610764 KB Output is correct
19 Correct 311 ms 611648 KB Output is correct
20 Correct 272 ms 612740 KB Output is correct
21 Correct 300 ms 611900 KB Output is correct
22 Correct 262 ms 611548 KB Output is correct
23 Correct 286 ms 611644 KB Output is correct
24 Correct 297 ms 613292 KB Output is correct
25 Correct 304 ms 613288 KB Output is correct
26 Correct 267 ms 611584 KB Output is correct
27 Correct 297 ms 611648 KB Output is correct
28 Correct 253 ms 611652 KB Output is correct
29 Correct 300 ms 612748 KB Output is correct
30 Correct 315 ms 612372 KB Output is correct
31 Correct 283 ms 613020 KB Output is correct
32 Correct 293 ms 612824 KB Output is correct
33 Correct 274 ms 612760 KB Output is correct
34 Correct 313 ms 616788 KB Output is correct
35 Correct 282 ms 616908 KB Output is correct
36 Correct 282 ms 612844 KB Output is correct
37 Correct 280 ms 612848 KB Output is correct
38 Correct 268 ms 612784 KB Output is correct
39 Correct 638 ms 630072 KB Output is correct
40 Correct 253 ms 613204 KB Output is correct
41 Correct 326 ms 618232 KB Output is correct
42 Correct 317 ms 613636 KB Output is correct
43 Correct 287 ms 616700 KB Output is correct
44 Correct 313 ms 623244 KB Output is correct
45 Correct 303 ms 622980 KB Output is correct
46 Correct 432 ms 636336 KB Output is correct
47 Correct 539 ms 630204 KB Output is correct
48 Correct 592 ms 630144 KB Output is correct
49 Correct 512 ms 671448 KB Output is correct
50 Correct 505 ms 671344 KB Output is correct
51 Correct 451 ms 630692 KB Output is correct
52 Correct 473 ms 630556 KB Output is correct
53 Correct 587 ms 630488 KB Output is correct
54 Correct 289 ms 610800 KB Output is correct
55 Correct 363 ms 610864 KB Output is correct
56 Correct 274 ms 610868 KB Output is correct
57 Correct 270 ms 610768 KB Output is correct
58 Correct 274 ms 610828 KB Output is correct
59 Correct 268 ms 610872 KB Output is correct
60 Correct 267 ms 610784 KB Output is correct
61 Correct 281 ms 610876 KB Output is correct
62 Correct 271 ms 610832 KB Output is correct
63 Correct 264 ms 610800 KB Output is correct
64 Correct 299 ms 610840 KB Output is correct
65 Correct 268 ms 610892 KB Output is correct
66 Correct 275 ms 610876 KB Output is correct
67 Correct 267 ms 610884 KB Output is correct
68 Correct 267 ms 610836 KB Output is correct
69 Correct 280 ms 610912 KB Output is correct
70 Correct 284 ms 610780 KB Output is correct
71 Correct 266 ms 610744 KB Output is correct
72 Correct 268 ms 610776 KB Output is correct
73 Correct 268 ms 610872 KB Output is correct
74 Correct 287 ms 610808 KB Output is correct
75 Correct 272 ms 610852 KB Output is correct
76 Correct 260 ms 610844 KB Output is correct
77 Correct 282 ms 610864 KB Output is correct
78 Correct 294 ms 610804 KB Output is correct
79 Correct 275 ms 610852 KB Output is correct
80 Correct 281 ms 610808 KB Output is correct
81 Correct 262 ms 610828 KB Output is correct
82 Correct 249 ms 610996 KB Output is correct
83 Correct 295 ms 610764 KB Output is correct
84 Correct 301 ms 610880 KB Output is correct
85 Correct 268 ms 610880 KB Output is correct
86 Correct 259 ms 610868 KB Output is correct
87 Correct 268 ms 610864 KB Output is correct
88 Correct 261 ms 610868 KB Output is correct
89 Correct 274 ms 610828 KB Output is correct
90 Correct 276 ms 610816 KB Output is correct
91 Correct 267 ms 610896 KB Output is correct
92 Correct 283 ms 610824 KB Output is correct
93 Correct 287 ms 610968 KB Output is correct
94 Correct 283 ms 610808 KB Output is correct
95 Correct 274 ms 610800 KB Output is correct
96 Correct 277 ms 610848 KB Output is correct
97 Correct 275 ms 610792 KB Output is correct
98 Correct 275 ms 610760 KB Output is correct
99 Correct 281 ms 610896 KB Output is correct
100 Correct 274 ms 610776 KB Output is correct
101 Correct 276 ms 610900 KB Output is correct
102 Correct 280 ms 610880 KB Output is correct
103 Correct 279 ms 610872 KB Output is correct
104 Correct 276 ms 610872 KB Output is correct
105 Correct 275 ms 610764 KB Output is correct
106 Correct 279 ms 610876 KB Output is correct
107 Correct 277 ms 610804 KB Output is correct
108 Correct 270 ms 610880 KB Output is correct
109 Correct 279 ms 611024 KB Output is correct
110 Correct 280 ms 611364 KB Output is correct
111 Correct 282 ms 611924 KB Output is correct
112 Correct 297 ms 611964 KB Output is correct
113 Correct 280 ms 611720 KB Output is correct
114 Correct 288 ms 611796 KB Output is correct
115 Correct 280 ms 611708 KB Output is correct
116 Correct 301 ms 611696 KB Output is correct
117 Correct 286 ms 611728 KB Output is correct
118 Correct 292 ms 611688 KB Output is correct
119 Correct 317 ms 613624 KB Output is correct
120 Correct 288 ms 613124 KB Output is correct
121 Correct 441 ms 613580 KB Output is correct
122 Correct 278 ms 613032 KB Output is correct
123 Correct 275 ms 612912 KB Output is correct
124 Correct 393 ms 620860 KB Output is correct
125 Correct 551 ms 639028 KB Output is correct
126 Correct 395 ms 637152 KB Output is correct
127 Execution timed out 2085 ms 639100 KB Time limit exceeded
128 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 287 ms 610864 KB Output is correct
2 Correct 297 ms 610868 KB Output is correct
3 Correct 256 ms 610784 KB Output is correct
4 Correct 266 ms 610888 KB Output is correct
5 Correct 259 ms 610820 KB Output is correct
6 Correct 263 ms 610912 KB Output is correct
7 Correct 256 ms 610804 KB Output is correct
8 Correct 297 ms 610904 KB Output is correct
9 Correct 265 ms 610860 KB Output is correct
10 Correct 294 ms 610812 KB Output is correct
11 Correct 259 ms 610812 KB Output is correct
12 Correct 252 ms 610764 KB Output is correct
13 Correct 284 ms 610820 KB Output is correct
14 Correct 276 ms 610860 KB Output is correct
15 Correct 292 ms 610868 KB Output is correct
16 Correct 291 ms 610876 KB Output is correct
17 Correct 310 ms 610880 KB Output is correct
18 Correct 274 ms 610764 KB Output is correct
19 Correct 311 ms 611648 KB Output is correct
20 Correct 272 ms 612740 KB Output is correct
21 Correct 300 ms 611900 KB Output is correct
22 Correct 262 ms 611548 KB Output is correct
23 Correct 286 ms 611644 KB Output is correct
24 Correct 297 ms 613292 KB Output is correct
25 Correct 304 ms 613288 KB Output is correct
26 Correct 267 ms 611584 KB Output is correct
27 Correct 297 ms 611648 KB Output is correct
28 Correct 253 ms 611652 KB Output is correct
29 Correct 300 ms 612748 KB Output is correct
30 Correct 315 ms 612372 KB Output is correct
31 Correct 283 ms 613020 KB Output is correct
32 Correct 293 ms 612824 KB Output is correct
33 Correct 274 ms 612760 KB Output is correct
34 Correct 313 ms 616788 KB Output is correct
35 Correct 282 ms 616908 KB Output is correct
36 Correct 282 ms 612844 KB Output is correct
37 Correct 280 ms 612848 KB Output is correct
38 Correct 268 ms 612784 KB Output is correct
39 Correct 638 ms 630072 KB Output is correct
40 Correct 253 ms 613204 KB Output is correct
41 Correct 326 ms 618232 KB Output is correct
42 Correct 317 ms 613636 KB Output is correct
43 Correct 287 ms 616700 KB Output is correct
44 Correct 313 ms 623244 KB Output is correct
45 Correct 303 ms 622980 KB Output is correct
46 Correct 432 ms 636336 KB Output is correct
47 Correct 539 ms 630204 KB Output is correct
48 Correct 592 ms 630144 KB Output is correct
49 Correct 512 ms 671448 KB Output is correct
50 Correct 505 ms 671344 KB Output is correct
51 Correct 451 ms 630692 KB Output is correct
52 Correct 473 ms 630556 KB Output is correct
53 Correct 587 ms 630488 KB Output is correct
54 Correct 289 ms 610800 KB Output is correct
55 Correct 363 ms 610864 KB Output is correct
56 Correct 274 ms 610868 KB Output is correct
57 Correct 270 ms 610768 KB Output is correct
58 Correct 274 ms 610828 KB Output is correct
59 Correct 268 ms 610872 KB Output is correct
60 Correct 267 ms 610784 KB Output is correct
61 Correct 281 ms 610876 KB Output is correct
62 Correct 271 ms 610832 KB Output is correct
63 Correct 264 ms 610800 KB Output is correct
64 Correct 299 ms 610840 KB Output is correct
65 Correct 268 ms 610892 KB Output is correct
66 Correct 275 ms 610876 KB Output is correct
67 Correct 267 ms 610884 KB Output is correct
68 Correct 267 ms 610836 KB Output is correct
69 Correct 280 ms 610912 KB Output is correct
70 Correct 284 ms 610780 KB Output is correct
71 Correct 266 ms 610744 KB Output is correct
72 Correct 268 ms 610776 KB Output is correct
73 Correct 268 ms 610872 KB Output is correct
74 Correct 287 ms 610808 KB Output is correct
75 Correct 272 ms 610852 KB Output is correct
76 Correct 260 ms 610844 KB Output is correct
77 Correct 282 ms 610864 KB Output is correct
78 Correct 294 ms 610804 KB Output is correct
79 Correct 275 ms 610852 KB Output is correct
80 Correct 281 ms 610808 KB Output is correct
81 Correct 262 ms 610828 KB Output is correct
82 Correct 249 ms 610996 KB Output is correct
83 Correct 295 ms 610764 KB Output is correct
84 Correct 301 ms 610880 KB Output is correct
85 Correct 268 ms 610880 KB Output is correct
86 Correct 259 ms 610868 KB Output is correct
87 Correct 268 ms 610864 KB Output is correct
88 Correct 261 ms 610868 KB Output is correct
89 Correct 274 ms 610828 KB Output is correct
90 Correct 276 ms 610816 KB Output is correct
91 Correct 267 ms 610896 KB Output is correct
92 Correct 283 ms 610824 KB Output is correct
93 Correct 287 ms 610968 KB Output is correct
94 Correct 283 ms 610808 KB Output is correct
95 Correct 274 ms 610800 KB Output is correct
96 Correct 277 ms 610848 KB Output is correct
97 Correct 275 ms 610792 KB Output is correct
98 Correct 275 ms 610760 KB Output is correct
99 Correct 281 ms 610896 KB Output is correct
100 Correct 274 ms 610776 KB Output is correct
101 Correct 276 ms 610900 KB Output is correct
102 Correct 280 ms 610880 KB Output is correct
103 Correct 279 ms 610872 KB Output is correct
104 Correct 276 ms 610872 KB Output is correct
105 Correct 275 ms 610764 KB Output is correct
106 Correct 279 ms 610876 KB Output is correct
107 Correct 277 ms 610804 KB Output is correct
108 Correct 270 ms 610880 KB Output is correct
109 Correct 279 ms 611024 KB Output is correct
110 Correct 280 ms 611364 KB Output is correct
111 Correct 282 ms 611924 KB Output is correct
112 Correct 297 ms 611964 KB Output is correct
113 Correct 280 ms 611720 KB Output is correct
114 Correct 288 ms 611796 KB Output is correct
115 Correct 280 ms 611708 KB Output is correct
116 Correct 301 ms 611696 KB Output is correct
117 Correct 286 ms 611728 KB Output is correct
118 Correct 292 ms 611688 KB Output is correct
119 Correct 317 ms 613624 KB Output is correct
120 Correct 288 ms 613124 KB Output is correct
121 Correct 441 ms 613580 KB Output is correct
122 Correct 278 ms 613032 KB Output is correct
123 Correct 275 ms 612912 KB Output is correct
124 Correct 393 ms 620860 KB Output is correct
125 Correct 551 ms 639028 KB Output is correct
126 Correct 395 ms 637152 KB Output is correct
127 Execution timed out 2085 ms 639100 KB Time limit exceeded
128 Halted 0 ms 0 KB -