답안 #766851

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
766851 2023-06-26T08:12:20 Z Kihihihi 벽 칠하기 (APIO20_paint) C++17
100 / 100
350 ms 505128 KB
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <ctime>
#include <chrono>
#include <cstdio>
#include <random>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <queue>
#include <bitset>
#include <list>
#include <fstream>
#include <functional>
#include <complex>
#include "paint.h"
using namespace std;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int INF = 1e9, MOD = 1e9 + 7, MOD2 = 998244353, LOG = 20;
const long double EPS = 1e-9, PI = acos(-1);

struct quemin
{
    int l = 0, r = -1;
    deque<pair<int, int>> q;

    quemin() {}

    void push_back(int x)
    {
        while (q.size() && q.back().first >= x)
        {
            q.pop_back();
        }
        r++;
        q.push_back({ x, r });
    }

    void pop_front()
    {
        if (q.front().second == l)
        {
            q.pop_front();
        }
        l++;
    }

    int get()
    {
        return q.front().first;
    }
};

int minimumInstructions(int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B)
{
    int n = N, m = M, k = K;
    vector<int> c = C, a = A;
    vector<vector<int>> b = B;

    vector<vector<int>> like(k);
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < b[i].size(); j++)
        {
            like[b[i][j]].push_back(i);
        }
    }

    vector<vector<int>> has(n);
    for (int i = 0; i < n; i++)
    {
        has[i] = like[c[i]];
    }

    vector<vector<int>> tomx(n);
    vector<pair<int, int>> nxt(m, { -1, -1 });
    vector<int> pos0(n, -1);
    for (int i = n - 1; i > -1; i--)
    {
        tomx[i].resize(has[i].size());
        for (int j = 0; j < has[i].size(); j++)
        {
            tomx[i][j] = has[i][j];
            if (has[i][j] == m - 1)
            {
                continue;
            }

            if (nxt[has[i][j] + 1].first == i + 1)
            {
                tomx[i][j] = tomx[nxt[has[i][j] + 1].first][nxt[has[i][j] + 1].second];
            }
        }

        for (int j = 0; j < has[i].size(); j++)
        {
            if (has[i][j] == 0)
            {
                pos0[i] = j;
            }

            nxt[has[i][j]] = { i, j };
        }
    }

    vector<bool> can(n);
    for (int i = n - m; i > -1; i--)
    {
        for (int j = 0; j < has[i].size(); j++)
        {
            if (tomx[i][j] != m - 1)
            {
                continue;
            }
            
            if (has[i][j] != 0)
            {
                int to = i + (m - has[i][j]);
                if (pos0[to] == -1)
                {
                    continue;
                }
                if (tomx[to][pos0[to]] < has[i][j] - 1)
                {
                    continue;
                }
            }

            can[i] = true;
            break;
        }
    }

    vector<int> dp(n + 1, INF);
    dp[n] = 0;
    quemin qmn;
    for (int i = 0; i < m; i++)
    {
        qmn.push_back(dp[n - i]);
    }
    for (int i = n - m; i > -1; i--)
    {
        if (can[i] && qmn.get() != INF)
        {
            dp[i] = 1 + qmn.get();
        }
        
        qmn.pop_front();
        qmn.push_back(dp[i]);
    }

    return (dp[0] == INF ? -1 : dp[0]);
}

/*
int main()
{
    int N, M, K;
    assert(3 == scanf("%d %d %d", &N, &M, &K));

    std::vector<int> C(N);
    for (int i = 0; i < N; ++i)
    {
        assert(1 == scanf("%d", &C[i]));
    }

    std::vector<int> A(M);
    std::vector<std::vector<int>> B(M);
    for (int i = 0; i < M; ++i)
    {
        assert(1 == scanf("%d", &A[i]));
        B[i].resize(A[i]);
        for (int j = 0; j < A[i]; ++j)
        {
            assert(1 == scanf("%d", &B[i][j]));
        }
    }

    int minimum_instructions = minimumInstructions(N, M, K, C, A, B);
    printf("%d\n", minimum_instructions);

    return 0;
}
*/

/*
<3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠖⠚⢉⣩⣭⡭⠛⠓⠲⠦⣄⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⡴⠃⢀⡴⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣆⠀⠀⠀
⠀⠀⠀⠀⡾⠁⣠⠋⠀⠈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⠀⠀
⠀⠀⠀⣸⠁⢰⠃⠀⠀⠀⠈⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣇⠀
⠀⠀⠀⡇⠀⡾⡀⠀⠀⠀⠀⣀⣹⣆⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀
⠀⠀⢸⠃⢀⣇⡈⠀⠀⠀⠀⠀⠀⢀⡑⢄⡀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇
⠀⠀⢸⠀⢻⡟⡻⢶⡆⠀⠀⠀⠀⡼⠟⡳⢿⣦⡑⢄⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇
⠀⠀⣸⠀⢸⠃⡇⢀⠇⠀⠀⠀⠀⠀⡼⠀⠀⠈⣿⡗⠂⠀⠀⠀⠀⠀⠀⠀⢸⠁
⠀⠀⡏⠀⣼⠀⢳⠊⠀⠀⠀⠀⠀⠀⠱⣀⣀⠔⣸⠁⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀
⠀⠀⡇⢀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀
⠀⢸⠃⠘⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠁⠀⠀⢀⠀⠀⠀⠀⠀⣾⠀⠀
⠀⣸⠀⠀⠹⡄⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⡞⠀⠀⠀⠸⠀⠀⠀⠀⠀⡇⠀⠀
⠀⡏⠀⠀⠀⠙⣆⠀⠀⠀⠀⠀⠀⠀⢀⣠⢶⡇⠀⠀⢰⡀⠀⠀⠀⠀⠀⡇⠀⠀
⢰⠇⡄⠀⠀⠀⡿⢣⣀⣀⣀⡤⠴⡞⠉⠀⢸⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⣧⠀⠀
⣸⠀⡇⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⢹⠀⠀⢸⠀⠀⢀⣿⠇⠀⠀⠀⠁⠀⢸⠀⠀
⣿⠀⡇⠀⠀⠀⠀⠀⢀⡤⠤⠶⠶⠾⠤⠄⢸⠀⡀⠸⣿⣀⠀⠀⠀⠀⠀⠈⣇⠀
⡇⠀⡇⠀⠀⡀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠸⡌⣵⡀⢳⡇⠀⠀⠀⠀⠀⠀⢹⡀
⡇⠀⠇⠀⠀⡇⡸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠮⢧⣀⣻⢂⠀⠀⠀⠀⠀⠀⢧
⣇⠀⢠⠀⠀⢳⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡎⣆⠀⠀⠀⠀⠀⠘
⢻⠀⠈⠰⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⠘⢮⣧⡀⠀⠀⠀⠀
⠸⡆⠀⠀⠇⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠆⠀⠀⠀⠀⠀⠀⠀⠙⠳⣄⡀⢢⡀
<3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3 <3
*/

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:73:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |         for (int j = 0; j < b[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~
paint.cpp:91:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |         for (int j = 0; j < has[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~~~
paint.cpp:105:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |         for (int j = 0; j < has[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~~~
paint.cpp:119:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  119 |         for (int j = 0; j < has[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 340 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 2 ms 2772 KB Output is correct
14 Correct 2 ms 2736 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 2 ms 2772 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 2 ms 2772 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 15 ms 7532 KB Output is correct
23 Correct 15 ms 7536 KB Output is correct
24 Correct 15 ms 7508 KB Output is correct
25 Correct 4 ms 2900 KB Output is correct
26 Correct 4 ms 2876 KB Output is correct
27 Correct 5 ms 2852 KB Output is correct
28 Correct 5 ms 2900 KB Output is correct
29 Correct 4 ms 2872 KB Output is correct
30 Correct 5 ms 2900 KB Output is correct
31 Correct 9 ms 6560 KB Output is correct
32 Correct 9 ms 6508 KB Output is correct
33 Correct 9 ms 6484 KB Output is correct
34 Correct 9 ms 6484 KB Output is correct
35 Correct 9 ms 6524 KB Output is correct
36 Correct 9 ms 6528 KB Output is correct
37 Correct 20 ms 10480 KB Output is correct
38 Correct 20 ms 10488 KB Output is correct
39 Correct 20 ms 10456 KB Output is correct
40 Correct 17 ms 12136 KB Output is correct
41 Correct 11 ms 7692 KB Output is correct
42 Correct 24 ms 13144 KB Output is correct
43 Correct 14 ms 8788 KB Output is correct
44 Correct 12 ms 8084 KB Output is correct
45 Correct 20 ms 13284 KB Output is correct
46 Correct 45 ms 26480 KB Output is correct
47 Correct 28 ms 16416 KB Output is correct
48 Correct 33 ms 20216 KB Output is correct
49 Correct 39 ms 20856 KB Output is correct
50 Correct 39 ms 21384 KB Output is correct
51 Correct 34 ms 18172 KB Output is correct
52 Correct 19 ms 13436 KB Output is correct
53 Correct 20 ms 13436 KB Output is correct
54 Correct 23 ms 13404 KB Output is correct
55 Correct 21 ms 13396 KB Output is correct
56 Correct 21 ms 13408 KB Output is correct
57 Correct 20 ms 13396 KB Output is correct
58 Correct 52 ms 29128 KB Output is correct
59 Correct 51 ms 29116 KB Output is correct
60 Correct 62 ms 29096 KB Output is correct
61 Correct 52 ms 29096 KB Output is correct
62 Correct 51 ms 29152 KB Output is correct
63 Correct 51 ms 29116 KB Output is correct
64 Correct 55 ms 27816 KB Output is correct
65 Correct 59 ms 27852 KB Output is correct
66 Correct 52 ms 27816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 340 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 2 ms 2772 KB Output is correct
14 Correct 2 ms 2736 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 2 ms 2772 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 2 ms 2772 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 308 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 304 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 2356 KB Output is correct
34 Correct 1 ms 1876 KB Output is correct
35 Correct 2 ms 1584 KB Output is correct
36 Correct 2 ms 2612 KB Output is correct
37 Correct 1 ms 2260 KB Output is correct
38 Correct 2 ms 2388 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 2132 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 2516 KB Output is correct
43 Correct 2 ms 2516 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 2 ms 2772 KB Output is correct
51 Correct 2 ms 2772 KB Output is correct
52 Correct 2 ms 2772 KB Output is correct
53 Correct 2 ms 2772 KB Output is correct
54 Correct 2 ms 2772 KB Output is correct
55 Correct 2 ms 2772 KB Output is correct
56 Correct 2 ms 2772 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 2 ms 2752 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 2 ms 2772 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 2 ms 2736 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 2 ms 2772 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2772 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2772 KB Output is correct
24 Correct 15 ms 7532 KB Output is correct
25 Correct 15 ms 7536 KB Output is correct
26 Correct 15 ms 7508 KB Output is correct
27 Correct 0 ms 308 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 304 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 300 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 2356 KB Output is correct
37 Correct 1 ms 1876 KB Output is correct
38 Correct 2 ms 1584 KB Output is correct
39 Correct 2 ms 2612 KB Output is correct
40 Correct 1 ms 2260 KB Output is correct
41 Correct 2 ms 2388 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 2132 KB Output is correct
44 Correct 1 ms 340 KB Output is correct
45 Correct 1 ms 2516 KB Output is correct
46 Correct 2 ms 2516 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 468 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 2 ms 2772 KB Output is correct
54 Correct 2 ms 2772 KB Output is correct
55 Correct 2 ms 2772 KB Output is correct
56 Correct 2 ms 2772 KB Output is correct
57 Correct 2 ms 2772 KB Output is correct
58 Correct 2 ms 2772 KB Output is correct
59 Correct 2 ms 2772 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 2752 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 2 ms 2772 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 724 KB Output is correct
66 Correct 1 ms 468 KB Output is correct
67 Correct 1 ms 852 KB Output is correct
68 Correct 1 ms 596 KB Output is correct
69 Correct 1 ms 724 KB Output is correct
70 Correct 3 ms 2644 KB Output is correct
71 Correct 2 ms 2260 KB Output is correct
72 Correct 2 ms 2048 KB Output is correct
73 Correct 2 ms 2108 KB Output is correct
74 Correct 2 ms 2516 KB Output is correct
75 Correct 2 ms 2900 KB Output is correct
76 Correct 16 ms 5632 KB Output is correct
77 Correct 16 ms 6596 KB Output is correct
78 Correct 19 ms 7500 KB Output is correct
79 Correct 1 ms 1108 KB Output is correct
80 Correct 1 ms 1108 KB Output is correct
81 Correct 2 ms 1156 KB Output is correct
82 Correct 1 ms 1108 KB Output is correct
83 Correct 1 ms 1108 KB Output is correct
84 Correct 3 ms 3156 KB Output is correct
85 Correct 3 ms 3156 KB Output is correct
86 Correct 3 ms 3156 KB Output is correct
87 Correct 3 ms 3048 KB Output is correct
88 Correct 3 ms 3132 KB Output is correct
89 Correct 3 ms 3128 KB Output is correct
90 Correct 21 ms 7868 KB Output is correct
91 Correct 21 ms 7884 KB Output is correct
92 Correct 22 ms 7884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 2 ms 2736 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 2 ms 2772 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2772 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2772 KB Output is correct
24 Correct 15 ms 7532 KB Output is correct
25 Correct 15 ms 7536 KB Output is correct
26 Correct 15 ms 7508 KB Output is correct
27 Correct 4 ms 2900 KB Output is correct
28 Correct 4 ms 2876 KB Output is correct
29 Correct 5 ms 2852 KB Output is correct
30 Correct 5 ms 2900 KB Output is correct
31 Correct 4 ms 2872 KB Output is correct
32 Correct 5 ms 2900 KB Output is correct
33 Correct 9 ms 6560 KB Output is correct
34 Correct 9 ms 6508 KB Output is correct
35 Correct 9 ms 6484 KB Output is correct
36 Correct 9 ms 6484 KB Output is correct
37 Correct 9 ms 6524 KB Output is correct
38 Correct 9 ms 6528 KB Output is correct
39 Correct 20 ms 10480 KB Output is correct
40 Correct 20 ms 10488 KB Output is correct
41 Correct 20 ms 10456 KB Output is correct
42 Correct 0 ms 308 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 304 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 300 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 1 ms 2356 KB Output is correct
52 Correct 1 ms 1876 KB Output is correct
53 Correct 2 ms 1584 KB Output is correct
54 Correct 2 ms 2612 KB Output is correct
55 Correct 1 ms 2260 KB Output is correct
56 Correct 2 ms 2388 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 2132 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 1 ms 2516 KB Output is correct
61 Correct 2 ms 2516 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 468 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 2 ms 2772 KB Output is correct
69 Correct 2 ms 2772 KB Output is correct
70 Correct 2 ms 2772 KB Output is correct
71 Correct 2 ms 2772 KB Output is correct
72 Correct 2 ms 2772 KB Output is correct
73 Correct 2 ms 2772 KB Output is correct
74 Correct 2 ms 2772 KB Output is correct
75 Correct 1 ms 340 KB Output is correct
76 Correct 2 ms 2752 KB Output is correct
77 Correct 1 ms 340 KB Output is correct
78 Correct 2 ms 2772 KB Output is correct
79 Correct 1 ms 340 KB Output is correct
80 Correct 1 ms 724 KB Output is correct
81 Correct 1 ms 468 KB Output is correct
82 Correct 1 ms 852 KB Output is correct
83 Correct 1 ms 596 KB Output is correct
84 Correct 1 ms 724 KB Output is correct
85 Correct 3 ms 2644 KB Output is correct
86 Correct 2 ms 2260 KB Output is correct
87 Correct 2 ms 2048 KB Output is correct
88 Correct 2 ms 2108 KB Output is correct
89 Correct 2 ms 2516 KB Output is correct
90 Correct 2 ms 2900 KB Output is correct
91 Correct 16 ms 5632 KB Output is correct
92 Correct 16 ms 6596 KB Output is correct
93 Correct 19 ms 7500 KB Output is correct
94 Correct 1 ms 1108 KB Output is correct
95 Correct 1 ms 1108 KB Output is correct
96 Correct 2 ms 1156 KB Output is correct
97 Correct 1 ms 1108 KB Output is correct
98 Correct 1 ms 1108 KB Output is correct
99 Correct 3 ms 3156 KB Output is correct
100 Correct 3 ms 3156 KB Output is correct
101 Correct 3 ms 3156 KB Output is correct
102 Correct 3 ms 3048 KB Output is correct
103 Correct 3 ms 3132 KB Output is correct
104 Correct 3 ms 3128 KB Output is correct
105 Correct 21 ms 7868 KB Output is correct
106 Correct 21 ms 7884 KB Output is correct
107 Correct 22 ms 7884 KB Output is correct
108 Correct 4 ms 2912 KB Output is correct
109 Correct 63 ms 71716 KB Output is correct
110 Correct 41 ms 39548 KB Output is correct
111 Correct 41 ms 29472 KB Output is correct
112 Correct 38 ms 34084 KB Output is correct
113 Correct 20 ms 22776 KB Output is correct
114 Correct 11 ms 5700 KB Output is correct
115 Correct 12 ms 5204 KB Output is correct
116 Correct 14 ms 6868 KB Output is correct
117 Correct 11 ms 4992 KB Output is correct
118 Correct 12 ms 5816 KB Output is correct
119 Correct 10 ms 5840 KB Output is correct
120 Correct 16 ms 6484 KB Output is correct
121 Correct 5 ms 2804 KB Output is correct
122 Correct 18 ms 6812 KB Output is correct
123 Correct 5 ms 2516 KB Output is correct
124 Correct 22 ms 8608 KB Output is correct
125 Correct 9 ms 4052 KB Output is correct
126 Correct 7 ms 4564 KB Output is correct
127 Correct 9 ms 5816 KB Output is correct
128 Correct 7 ms 4668 KB Output is correct
129 Correct 7 ms 4292 KB Output is correct
130 Correct 4 ms 2900 KB Output is correct
131 Correct 86 ms 101260 KB Output is correct
132 Correct 72 ms 72140 KB Output is correct
133 Correct 61 ms 59468 KB Output is correct
134 Correct 52 ms 51736 KB Output is correct
135 Correct 42 ms 46364 KB Output is correct
136 Correct 16 ms 7556 KB Output is correct
137 Correct 16 ms 7624 KB Output is correct
138 Correct 16 ms 7636 KB Output is correct
139 Correct 16 ms 7556 KB Output is correct
140 Correct 19 ms 7628 KB Output is correct
141 Correct 16 ms 7628 KB Output is correct
142 Correct 27 ms 10524 KB Output is correct
143 Correct 8 ms 4436 KB Output is correct
144 Correct 27 ms 10572 KB Output is correct
145 Correct 8 ms 4436 KB Output is correct
146 Correct 26 ms 10552 KB Output is correct
147 Correct 8 ms 4436 KB Output is correct
148 Correct 10 ms 6740 KB Output is correct
149 Correct 10 ms 6588 KB Output is correct
150 Correct 10 ms 6484 KB Output is correct
151 Correct 10 ms 6464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 2772 KB Output is correct
16 Correct 2 ms 2736 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 2 ms 2772 KB Output is correct
19 Correct 2 ms 2772 KB Output is correct
20 Correct 2 ms 2772 KB Output is correct
21 Correct 2 ms 2772 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 2 ms 2772 KB Output is correct
24 Correct 15 ms 7532 KB Output is correct
25 Correct 15 ms 7536 KB Output is correct
26 Correct 15 ms 7508 KB Output is correct
27 Correct 4 ms 2900 KB Output is correct
28 Correct 4 ms 2876 KB Output is correct
29 Correct 5 ms 2852 KB Output is correct
30 Correct 5 ms 2900 KB Output is correct
31 Correct 4 ms 2872 KB Output is correct
32 Correct 5 ms 2900 KB Output is correct
33 Correct 9 ms 6560 KB Output is correct
34 Correct 9 ms 6508 KB Output is correct
35 Correct 9 ms 6484 KB Output is correct
36 Correct 9 ms 6484 KB Output is correct
37 Correct 9 ms 6524 KB Output is correct
38 Correct 9 ms 6528 KB Output is correct
39 Correct 20 ms 10480 KB Output is correct
40 Correct 20 ms 10488 KB Output is correct
41 Correct 20 ms 10456 KB Output is correct
42 Correct 17 ms 12136 KB Output is correct
43 Correct 11 ms 7692 KB Output is correct
44 Correct 24 ms 13144 KB Output is correct
45 Correct 14 ms 8788 KB Output is correct
46 Correct 12 ms 8084 KB Output is correct
47 Correct 20 ms 13284 KB Output is correct
48 Correct 45 ms 26480 KB Output is correct
49 Correct 28 ms 16416 KB Output is correct
50 Correct 33 ms 20216 KB Output is correct
51 Correct 39 ms 20856 KB Output is correct
52 Correct 39 ms 21384 KB Output is correct
53 Correct 34 ms 18172 KB Output is correct
54 Correct 19 ms 13436 KB Output is correct
55 Correct 20 ms 13436 KB Output is correct
56 Correct 23 ms 13404 KB Output is correct
57 Correct 21 ms 13396 KB Output is correct
58 Correct 21 ms 13408 KB Output is correct
59 Correct 20 ms 13396 KB Output is correct
60 Correct 52 ms 29128 KB Output is correct
61 Correct 51 ms 29116 KB Output is correct
62 Correct 62 ms 29096 KB Output is correct
63 Correct 52 ms 29096 KB Output is correct
64 Correct 51 ms 29152 KB Output is correct
65 Correct 51 ms 29116 KB Output is correct
66 Correct 55 ms 27816 KB Output is correct
67 Correct 59 ms 27852 KB Output is correct
68 Correct 52 ms 27816 KB Output is correct
69 Correct 0 ms 308 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 304 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 340 KB Output is correct
74 Correct 1 ms 340 KB Output is correct
75 Correct 1 ms 300 KB Output is correct
76 Correct 1 ms 340 KB Output is correct
77 Correct 1 ms 340 KB Output is correct
78 Correct 1 ms 2356 KB Output is correct
79 Correct 1 ms 1876 KB Output is correct
80 Correct 2 ms 1584 KB Output is correct
81 Correct 2 ms 2612 KB Output is correct
82 Correct 1 ms 2260 KB Output is correct
83 Correct 2 ms 2388 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 2132 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 1 ms 2516 KB Output is correct
88 Correct 2 ms 2516 KB Output is correct
89 Correct 1 ms 340 KB Output is correct
90 Correct 1 ms 468 KB Output is correct
91 Correct 1 ms 340 KB Output is correct
92 Correct 1 ms 340 KB Output is correct
93 Correct 1 ms 340 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 2 ms 2772 KB Output is correct
96 Correct 2 ms 2772 KB Output is correct
97 Correct 2 ms 2772 KB Output is correct
98 Correct 2 ms 2772 KB Output is correct
99 Correct 2 ms 2772 KB Output is correct
100 Correct 2 ms 2772 KB Output is correct
101 Correct 2 ms 2772 KB Output is correct
102 Correct 1 ms 340 KB Output is correct
103 Correct 2 ms 2752 KB Output is correct
104 Correct 1 ms 340 KB Output is correct
105 Correct 2 ms 2772 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 724 KB Output is correct
108 Correct 1 ms 468 KB Output is correct
109 Correct 1 ms 852 KB Output is correct
110 Correct 1 ms 596 KB Output is correct
111 Correct 1 ms 724 KB Output is correct
112 Correct 3 ms 2644 KB Output is correct
113 Correct 2 ms 2260 KB Output is correct
114 Correct 2 ms 2048 KB Output is correct
115 Correct 2 ms 2108 KB Output is correct
116 Correct 2 ms 2516 KB Output is correct
117 Correct 2 ms 2900 KB Output is correct
118 Correct 16 ms 5632 KB Output is correct
119 Correct 16 ms 6596 KB Output is correct
120 Correct 19 ms 7500 KB Output is correct
121 Correct 1 ms 1108 KB Output is correct
122 Correct 1 ms 1108 KB Output is correct
123 Correct 2 ms 1156 KB Output is correct
124 Correct 1 ms 1108 KB Output is correct
125 Correct 1 ms 1108 KB Output is correct
126 Correct 3 ms 3156 KB Output is correct
127 Correct 3 ms 3156 KB Output is correct
128 Correct 3 ms 3156 KB Output is correct
129 Correct 3 ms 3048 KB Output is correct
130 Correct 3 ms 3132 KB Output is correct
131 Correct 3 ms 3128 KB Output is correct
132 Correct 21 ms 7868 KB Output is correct
133 Correct 21 ms 7884 KB Output is correct
134 Correct 22 ms 7884 KB Output is correct
135 Correct 4 ms 2912 KB Output is correct
136 Correct 63 ms 71716 KB Output is correct
137 Correct 41 ms 39548 KB Output is correct
138 Correct 41 ms 29472 KB Output is correct
139 Correct 38 ms 34084 KB Output is correct
140 Correct 20 ms 22776 KB Output is correct
141 Correct 11 ms 5700 KB Output is correct
142 Correct 12 ms 5204 KB Output is correct
143 Correct 14 ms 6868 KB Output is correct
144 Correct 11 ms 4992 KB Output is correct
145 Correct 12 ms 5816 KB Output is correct
146 Correct 10 ms 5840 KB Output is correct
147 Correct 16 ms 6484 KB Output is correct
148 Correct 5 ms 2804 KB Output is correct
149 Correct 18 ms 6812 KB Output is correct
150 Correct 5 ms 2516 KB Output is correct
151 Correct 22 ms 8608 KB Output is correct
152 Correct 9 ms 4052 KB Output is correct
153 Correct 7 ms 4564 KB Output is correct
154 Correct 9 ms 5816 KB Output is correct
155 Correct 7 ms 4668 KB Output is correct
156 Correct 7 ms 4292 KB Output is correct
157 Correct 4 ms 2900 KB Output is correct
158 Correct 86 ms 101260 KB Output is correct
159 Correct 72 ms 72140 KB Output is correct
160 Correct 61 ms 59468 KB Output is correct
161 Correct 52 ms 51736 KB Output is correct
162 Correct 42 ms 46364 KB Output is correct
163 Correct 16 ms 7556 KB Output is correct
164 Correct 16 ms 7624 KB Output is correct
165 Correct 16 ms 7636 KB Output is correct
166 Correct 16 ms 7556 KB Output is correct
167 Correct 19 ms 7628 KB Output is correct
168 Correct 16 ms 7628 KB Output is correct
169 Correct 27 ms 10524 KB Output is correct
170 Correct 8 ms 4436 KB Output is correct
171 Correct 27 ms 10572 KB Output is correct
172 Correct 8 ms 4436 KB Output is correct
173 Correct 26 ms 10552 KB Output is correct
174 Correct 8 ms 4436 KB Output is correct
175 Correct 10 ms 6740 KB Output is correct
176 Correct 10 ms 6588 KB Output is correct
177 Correct 10 ms 6484 KB Output is correct
178 Correct 10 ms 6464 KB Output is correct
179 Correct 12 ms 8404 KB Output is correct
180 Correct 150 ms 202676 KB Output is correct
181 Correct 192 ms 228172 KB Output is correct
182 Correct 241 ms 285420 KB Output is correct
183 Correct 129 ms 144408 KB Output is correct
184 Correct 111 ms 119616 KB Output is correct
185 Correct 26 ms 12748 KB Output is correct
186 Correct 30 ms 16724 KB Output is correct
187 Correct 32 ms 15152 KB Output is correct
188 Correct 35 ms 16368 KB Output is correct
189 Correct 36 ms 17752 KB Output is correct
190 Correct 45 ms 17360 KB Output is correct
191 Correct 36 ms 17876 KB Output is correct
192 Correct 28 ms 13016 KB Output is correct
193 Correct 27 ms 13348 KB Output is correct
194 Correct 20 ms 13396 KB Output is correct
195 Correct 350 ms 505128 KB Output is correct
196 Correct 293 ms 359476 KB Output is correct
197 Correct 240 ms 295392 KB Output is correct
198 Correct 215 ms 257036 KB Output is correct
199 Correct 198 ms 230296 KB Output is correct
200 Correct 61 ms 29724 KB Output is correct
201 Correct 64 ms 29720 KB Output is correct
202 Correct 62 ms 29704 KB Output is correct
203 Correct 62 ms 29624 KB Output is correct
204 Correct 69 ms 29732 KB Output is correct
205 Correct 63 ms 29644 KB Output is correct
206 Correct 58 ms 27212 KB Output is correct
207 Correct 52 ms 27884 KB Output is correct
208 Correct 64 ms 27220 KB Output is correct
209 Correct 52 ms 27936 KB Output is correct
210 Correct 58 ms 27208 KB Output is correct
211 Correct 51 ms 27980 KB Output is correct
212 Correct 56 ms 29316 KB Output is correct
213 Correct 50 ms 24768 KB Output is correct
214 Correct 50 ms 24012 KB Output is correct
215 Correct 49 ms 23720 KB Output is correct