답안 #999752

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999752 2024-06-16T06:17:24 Z underwaterkillerwhale 벽 칠하기 (APIO20_paint) C++17
63 / 100
222 ms 319316 KB
#include "paint.h"

#include <bits/stdc++.h>
#define se              second
#define fs              first
#define mp              make_pair
#define pb              push_back
#define ll              long long
#define ii              pair<ll,ll>
#define ld              long double
#define SZ(v)           (int)v.size()
#define ALL(v)          v.begin(), v.end()
#define bit(msk, i)     ((msk >> i) & 1)
#define iter(id, v)     for(auto id : v)
#define rep(i,m,n)      for(int i=(m); i<=(n); i++)
#define reb(i,m,n)      for(int i=(m); i>=(n); i--)

using namespace std;

mt19937_64 rd(chrono :: steady_clock :: now().time_since_epoch().count());
ll Rand(ll l, ll r) { return uniform_int_distribution<ll> (l, r)(rd); }

const int N  = 2e5 + 7;
const int Mod = 998244353;
const int szBL = 916;
const int INF = 1e9;
const int BASE = 137;
int n, m, K;

vector<int> A, C;
vector<vector<int>> B;

namespace sub1  {
    int idxA[N], f[N];

    bool check () {
        rep (i, 0, m - 1) iter (&col, B[i]) f[col]++;
//        rep (i, 0, K - 1) cout << f[i] <<"\n";
        return *max_element (f, f + K) <= 1;
    }

    int solution() {
        rep (i, 0, K - 1) idxA[i] = -1;
        rep (i, 0, m - 1) {
            iter (&col, B[i]) idxA[col] = i;
        }
        int st = idxA[C[0]];
        if (st == -1) return -1;
        int res = 1;
        rep (i, 1, n - 1) {
            if (i % m == 0) ++res;
            (st += 1) %= m;
            int pos = lower_bound (ALL(B[st]), C[i]) - B[st].begin();
            if (pos == SZ(B[st]) || B[st][pos] != C[i]) return -1;
        }
        return res;
    }
}

namespace sub4 {
    const int N2 = 20000 + 2;
    const int M2 = 2000 + 2;
    int dp[N2][M2 * 2], f[N];
    bool ok[N2];

    vector<int> posC[N];

    struct Segment_Tree {
        int Range;
        int st[N << 2];

        void init (int n) {
            Range = n;
            rep (i, 1, n << 2) {
                st[i] = INF;
            }
        }

        void update (int id, int l, int r, int pos, int val) {
            if (l > pos || r < pos) return;
            if (l == r) {
                st[id] = val;
                return;
            }
            int mid = l + r >> 1;
            update (id << 1, l, mid, pos, val);
            update (id << 1 | 1, mid + 1, r, pos, val);
            st[id] = min(st[id << 1], st[id << 1 | 1]);
        }
        int get (int id, int l, int r, int u, int v) {
            if (l > v || r < u) return INF;
            if (l >= u && r <= v) return st[id];
            int mid = l + r >> 1;
            return min (get (id << 1, l, mid, u, v), get (id << 1 | 1, mid + 1, r, u, v));
        }

        void update (int pos, int val ) {
            update (1, 1, Range, pos, val);
        }
        int get (int u, int v) {
            return get (1, 1, Range, u, v);
        }
    }ST;

    int solution() {
        A.resize (2 * m);
        B.resize (2 * m);
        rep (i, m, 2 * m - 1) {
            A[i] = A[i - m];
            B[i] = B[i - m];
        }
        rep (i, 0, n - 1) posC[C[i]].push_back(i);
        rep (j, 0, 2 * m - 1) {
            iter (&col, B[j])
                iter (&pos, posC[col]) {
                dp[pos][j] = 1;
            }
        }
        reb (i, n - 1, 0) {
            reb (j, 2 * m - 1, 0) {
                if (dp[i][j] != 0) dp[i][j] = dp[i + 1][j + 1] + 1;
                if (dp[i][j] >= m) ok[i + 1] = 1;
            }
        }
        rep (i, 1, n) f[i] = INF;
        ST.init(n);
        f[m] = ok[1] ? 1 : INF;
        ST.update (m, f[m]);
        rep (i, 2, n - m + 1) {
            if (ok[i]) {
                f[i + m - 1] = ST.get (i - 1, i + m - 1) + 1;
                ST.update (i + m - 1, f[i + m - 1]);
            }
        }
        if (f[n] < INF) return f[n];
        else return -1;
    }
}


int minimumInstructions (int _n, int _m, int _K, vector<int> _C, vector<int> _A, vector<vector<int>> _B) {
//void solution() {
    n = _n;
    m = _m;
    K = _K;
    C = _C;
    A = _A;
    B = _B;
//    cin >> n >> m >> K;
//    C.resize(n);
//    rep (i, 0, n - 1) {
//        cin >> C[i];
//
//    }
//    A.resize (m);
//    B.resize (m);
//    rep (i, 0, m - 1) {
//        cin >> A[i];
//        B[i].resize (A[i]);
//        rep (j, 0, A[i] - 1) {
//            cin >> B[i][j];
//        }
//    }
    if (sub1 :: check())
        return sub1 :: solution();
//        cout << sub1 :: solution() <<"\n";
    else if (n <= 20000 && m <= 2000)
        return sub4 :: solution();
//        cout << sub4 :: solution() <<"\n";
//    else sub5 :: solution();
}

//#define file(name) freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout);
//int main () {
//    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
////    file ("c");
//    int num_Test = 1;
////    cin >> num_Test;
//    while (num_Test--)
//        solution();
//}
/*
8 3 6
3 2 1 3 2 1 3 2
2 2 4
1 1
2 3 5


5 4 4
1 0 1 2 2
2 0 1
1 1
1 2
1 3

*/

Compilation message

paint.cpp: In member function 'void sub4::Segment_Tree::update(int, int, int, int, int)':
paint.cpp:85:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   85 |             int mid = l + r >> 1;
      |                       ~~^~~
paint.cpp: In member function 'int sub4::Segment_Tree::get(int, int, int, int, int)':
paint.cpp:93:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   93 |             int mid = l + r >> 1;
      |                       ~~^~~
paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:171:1: warning: control reaches end of non-void function [-Wreturn-type]
  171 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8648 KB Output is correct
3 Correct 1 ms 8648 KB Output is correct
4 Correct 2 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 2 ms 8536 KB Output is correct
12 Correct 1 ms 8536 KB Output is correct
13 Correct 2 ms 9052 KB Output is correct
14 Correct 2 ms 9052 KB Output is correct
15 Correct 3 ms 9052 KB Output is correct
16 Correct 2 ms 9052 KB Output is correct
17 Correct 2 ms 9052 KB Output is correct
18 Correct 2 ms 9048 KB Output is correct
19 Correct 1 ms 9052 KB Output is correct
20 Correct 2 ms 9052 KB Output is correct
21 Correct 2 ms 9052 KB Output is correct
22 Correct 16 ms 10844 KB Output is correct
23 Correct 8 ms 10844 KB Output is correct
24 Correct 8 ms 10844 KB Output is correct
25 Correct 4 ms 8920 KB Output is correct
26 Correct 3 ms 8796 KB Output is correct
27 Correct 2 ms 8796 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 8 ms 10072 KB Output is correct
32 Correct 5 ms 9856 KB Output is correct
33 Correct 5 ms 10072 KB Output is correct
34 Correct 6 ms 9864 KB Output is correct
35 Correct 6 ms 9988 KB Output is correct
36 Correct 6 ms 10076 KB Output is correct
37 Correct 10 ms 11264 KB Output is correct
38 Correct 10 ms 11352 KB Output is correct
39 Correct 10 ms 11356 KB Output is correct
40 Correct 6 ms 9816 KB Output is correct
41 Correct 4 ms 9308 KB Output is correct
42 Correct 9 ms 9820 KB Output is correct
43 Correct 5 ms 9308 KB Output is correct
44 Correct 5 ms 9304 KB Output is correct
45 Correct 7 ms 10012 KB Output is correct
46 Correct 37 ms 19796 KB Output is correct
47 Correct 19 ms 14684 KB Output is correct
48 Correct 20 ms 18260 KB Output is correct
49 Correct 35 ms 17500 KB Output is correct
50 Correct 25 ms 16732 KB Output is correct
51 Correct 15 ms 14032 KB Output is correct
52 Correct 7 ms 9816 KB Output is correct
53 Correct 7 ms 9820 KB Output is correct
54 Correct 10 ms 9820 KB Output is correct
55 Correct 7 ms 9820 KB Output is correct
56 Correct 7 ms 9948 KB Output is correct
57 Correct 7 ms 9820 KB Output is correct
58 Correct 25 ms 20272 KB Output is correct
59 Correct 25 ms 20316 KB Output is correct
60 Correct 25 ms 20272 KB Output is correct
61 Correct 25 ms 20316 KB Output is correct
62 Correct 45 ms 20236 KB Output is correct
63 Correct 25 ms 20324 KB Output is correct
64 Correct 24 ms 19036 KB Output is correct
65 Correct 25 ms 19036 KB Output is correct
66 Correct 24 ms 19024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8648 KB Output is correct
3 Correct 1 ms 8648 KB Output is correct
4 Correct 2 ms 8540 KB Output is correct
5 Correct 1 ms 8540 KB Output is correct
6 Correct 1 ms 8540 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 2 ms 8536 KB Output is correct
12 Correct 1 ms 8536 KB Output is correct
13 Correct 2 ms 9052 KB Output is correct
14 Correct 2 ms 9052 KB Output is correct
15 Correct 3 ms 9052 KB Output is correct
16 Correct 2 ms 9052 KB Output is correct
17 Correct 2 ms 9052 KB Output is correct
18 Correct 2 ms 9048 KB Output is correct
19 Correct 1 ms 9052 KB Output is correct
20 Correct 2 ms 9052 KB Output is correct
21 Correct 2 ms 9052 KB Output is correct
22 Correct 1 ms 10588 KB Output is correct
23 Correct 1 ms 10700 KB Output is correct
24 Correct 2 ms 10588 KB Output is correct
25 Correct 2 ms 10588 KB Output is correct
26 Correct 2 ms 10588 KB Output is correct
27 Correct 2 ms 14684 KB Output is correct
28 Correct 2 ms 14828 KB Output is correct
29 Correct 2 ms 14684 KB Output is correct
30 Correct 2 ms 14684 KB Output is correct
31 Correct 2 ms 16732 KB Output is correct
32 Correct 2 ms 14684 KB Output is correct
33 Correct 3 ms 16988 KB Output is correct
34 Correct 3 ms 16732 KB Output is correct
35 Correct 2 ms 14684 KB Output is correct
36 Correct 3 ms 14940 KB Output is correct
37 Correct 2 ms 14904 KB Output is correct
38 Correct 2 ms 10840 KB Output is correct
39 Correct 3 ms 14684 KB Output is correct
40 Correct 2 ms 12632 KB Output is correct
41 Correct 2 ms 14684 KB Output is correct
42 Correct 2 ms 12892 KB Output is correct
43 Correct 2 ms 14940 KB Output is correct
44 Correct 2 ms 16732 KB Output is correct
45 Correct 2 ms 16732 KB Output is correct
46 Correct 2 ms 16732 KB Output is correct
47 Correct 2 ms 16848 KB Output is correct
48 Correct 2 ms 16732 KB Output is correct
49 Correct 2 ms 16732 KB Output is correct
50 Correct 2 ms 16984 KB Output is correct
51 Correct 3 ms 16988 KB Output is correct
52 Correct 3 ms 16988 KB Output is correct
53 Correct 2 ms 16988 KB Output is correct
54 Correct 3 ms 16988 KB Output is correct
55 Correct 3 ms 16988 KB Output is correct
56 Correct 2 ms 14804 KB Output is correct
57 Correct 2 ms 16732 KB Output is correct
58 Correct 3 ms 14940 KB Output is correct
59 Correct 3 ms 16732 KB Output is correct
60 Correct 3 ms 12892 KB Output is correct
61 Correct 2 ms 16728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 10588 KB Output is correct
2 Correct 1 ms 10700 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8648 KB Output is correct
5 Correct 1 ms 8648 KB Output is correct
6 Correct 2 ms 8540 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 2 ms 8536 KB Output is correct
14 Correct 1 ms 8536 KB Output is correct
15 Correct 2 ms 9052 KB Output is correct
16 Correct 2 ms 9052 KB Output is correct
17 Correct 3 ms 9052 KB Output is correct
18 Correct 2 ms 9052 KB Output is correct
19 Correct 2 ms 9052 KB Output is correct
20 Correct 2 ms 9048 KB Output is correct
21 Correct 1 ms 9052 KB Output is correct
22 Correct 2 ms 9052 KB Output is correct
23 Correct 2 ms 9052 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 8 ms 10844 KB Output is correct
26 Correct 8 ms 10844 KB Output is correct
27 Correct 2 ms 10588 KB Output is correct
28 Correct 2 ms 10588 KB Output is correct
29 Correct 2 ms 10588 KB Output is correct
30 Correct 2 ms 14684 KB Output is correct
31 Correct 2 ms 14828 KB Output is correct
32 Correct 2 ms 14684 KB Output is correct
33 Correct 2 ms 14684 KB Output is correct
34 Correct 2 ms 16732 KB Output is correct
35 Correct 2 ms 14684 KB Output is correct
36 Correct 3 ms 16988 KB Output is correct
37 Correct 3 ms 16732 KB Output is correct
38 Correct 2 ms 14684 KB Output is correct
39 Correct 3 ms 14940 KB Output is correct
40 Correct 2 ms 14904 KB Output is correct
41 Correct 2 ms 10840 KB Output is correct
42 Correct 3 ms 14684 KB Output is correct
43 Correct 2 ms 12632 KB Output is correct
44 Correct 2 ms 14684 KB Output is correct
45 Correct 2 ms 12892 KB Output is correct
46 Correct 2 ms 14940 KB Output is correct
47 Correct 2 ms 16732 KB Output is correct
48 Correct 2 ms 16732 KB Output is correct
49 Correct 2 ms 16732 KB Output is correct
50 Correct 2 ms 16848 KB Output is correct
51 Correct 2 ms 16732 KB Output is correct
52 Correct 2 ms 16732 KB Output is correct
53 Correct 2 ms 16984 KB Output is correct
54 Correct 3 ms 16988 KB Output is correct
55 Correct 3 ms 16988 KB Output is correct
56 Correct 2 ms 16988 KB Output is correct
57 Correct 3 ms 16988 KB Output is correct
58 Correct 3 ms 16988 KB Output is correct
59 Correct 2 ms 14804 KB Output is correct
60 Correct 2 ms 16732 KB Output is correct
61 Correct 3 ms 14940 KB Output is correct
62 Correct 3 ms 16732 KB Output is correct
63 Correct 3 ms 12892 KB Output is correct
64 Correct 2 ms 16728 KB Output is correct
65 Correct 2 ms 14684 KB Output is correct
66 Correct 2 ms 16728 KB Output is correct
67 Correct 2 ms 16732 KB Output is correct
68 Correct 2 ms 16880 KB Output is correct
69 Correct 2 ms 16732 KB Output is correct
70 Correct 3 ms 16988 KB Output is correct
71 Correct 3 ms 16988 KB Output is correct
72 Correct 3 ms 17136 KB Output is correct
73 Correct 3 ms 16988 KB Output is correct
74 Correct 3 ms 14940 KB Output is correct
75 Correct 2 ms 14940 KB Output is correct
76 Correct 10 ms 16988 KB Output is correct
77 Correct 17 ms 17724 KB Output is correct
78 Correct 12 ms 17756 KB Output is correct
79 Correct 3 ms 16908 KB Output is correct
80 Correct 3 ms 16912 KB Output is correct
81 Correct 3 ms 16732 KB Output is correct
82 Correct 3 ms 16796 KB Output is correct
83 Correct 3 ms 16732 KB Output is correct
84 Correct 4 ms 17200 KB Output is correct
85 Correct 4 ms 17236 KB Output is correct
86 Correct 4 ms 17244 KB Output is correct
87 Correct 3 ms 17372 KB Output is correct
88 Correct 5 ms 17244 KB Output is correct
89 Correct 4 ms 17336 KB Output is correct
90 Correct 13 ms 20088 KB Output is correct
91 Correct 13 ms 20060 KB Output is correct
92 Correct 13 ms 20060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 10588 KB Output is correct
2 Correct 1 ms 10700 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8648 KB Output is correct
5 Correct 1 ms 8648 KB Output is correct
6 Correct 2 ms 8540 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 2 ms 8536 KB Output is correct
14 Correct 1 ms 8536 KB Output is correct
15 Correct 2 ms 9052 KB Output is correct
16 Correct 2 ms 9052 KB Output is correct
17 Correct 3 ms 9052 KB Output is correct
18 Correct 2 ms 9052 KB Output is correct
19 Correct 2 ms 9052 KB Output is correct
20 Correct 2 ms 9048 KB Output is correct
21 Correct 1 ms 9052 KB Output is correct
22 Correct 2 ms 9052 KB Output is correct
23 Correct 2 ms 9052 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 8 ms 10844 KB Output is correct
26 Correct 8 ms 10844 KB Output is correct
27 Correct 4 ms 8920 KB Output is correct
28 Correct 3 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 2 ms 8796 KB Output is correct
32 Correct 2 ms 8796 KB Output is correct
33 Correct 8 ms 10072 KB Output is correct
34 Correct 5 ms 9856 KB Output is correct
35 Correct 5 ms 10072 KB Output is correct
36 Correct 6 ms 9864 KB Output is correct
37 Correct 6 ms 9988 KB Output is correct
38 Correct 6 ms 10076 KB Output is correct
39 Correct 10 ms 11264 KB Output is correct
40 Correct 10 ms 11352 KB Output is correct
41 Correct 10 ms 11356 KB Output is correct
42 Correct 2 ms 10588 KB Output is correct
43 Correct 2 ms 10588 KB Output is correct
44 Correct 2 ms 10588 KB Output is correct
45 Correct 2 ms 14684 KB Output is correct
46 Correct 2 ms 14828 KB Output is correct
47 Correct 2 ms 14684 KB Output is correct
48 Correct 2 ms 14684 KB Output is correct
49 Correct 2 ms 16732 KB Output is correct
50 Correct 2 ms 14684 KB Output is correct
51 Correct 3 ms 16988 KB Output is correct
52 Correct 3 ms 16732 KB Output is correct
53 Correct 2 ms 14684 KB Output is correct
54 Correct 3 ms 14940 KB Output is correct
55 Correct 2 ms 14904 KB Output is correct
56 Correct 2 ms 10840 KB Output is correct
57 Correct 3 ms 14684 KB Output is correct
58 Correct 2 ms 12632 KB Output is correct
59 Correct 2 ms 14684 KB Output is correct
60 Correct 2 ms 12892 KB Output is correct
61 Correct 2 ms 14940 KB Output is correct
62 Correct 2 ms 16732 KB Output is correct
63 Correct 2 ms 16732 KB Output is correct
64 Correct 2 ms 16732 KB Output is correct
65 Correct 2 ms 16848 KB Output is correct
66 Correct 2 ms 16732 KB Output is correct
67 Correct 2 ms 16732 KB Output is correct
68 Correct 2 ms 16984 KB Output is correct
69 Correct 3 ms 16988 KB Output is correct
70 Correct 3 ms 16988 KB Output is correct
71 Correct 2 ms 16988 KB Output is correct
72 Correct 3 ms 16988 KB Output is correct
73 Correct 3 ms 16988 KB Output is correct
74 Correct 2 ms 14804 KB Output is correct
75 Correct 2 ms 16732 KB Output is correct
76 Correct 3 ms 14940 KB Output is correct
77 Correct 3 ms 16732 KB Output is correct
78 Correct 3 ms 12892 KB Output is correct
79 Correct 2 ms 16728 KB Output is correct
80 Correct 2 ms 14684 KB Output is correct
81 Correct 2 ms 16728 KB Output is correct
82 Correct 2 ms 16732 KB Output is correct
83 Correct 2 ms 16880 KB Output is correct
84 Correct 2 ms 16732 KB Output is correct
85 Correct 3 ms 16988 KB Output is correct
86 Correct 3 ms 16988 KB Output is correct
87 Correct 3 ms 17136 KB Output is correct
88 Correct 3 ms 16988 KB Output is correct
89 Correct 3 ms 14940 KB Output is correct
90 Correct 2 ms 14940 KB Output is correct
91 Correct 10 ms 16988 KB Output is correct
92 Correct 17 ms 17724 KB Output is correct
93 Correct 12 ms 17756 KB Output is correct
94 Correct 3 ms 16908 KB Output is correct
95 Correct 3 ms 16912 KB Output is correct
96 Correct 3 ms 16732 KB Output is correct
97 Correct 3 ms 16796 KB Output is correct
98 Correct 3 ms 16732 KB Output is correct
99 Correct 4 ms 17200 KB Output is correct
100 Correct 4 ms 17236 KB Output is correct
101 Correct 4 ms 17244 KB Output is correct
102 Correct 3 ms 17372 KB Output is correct
103 Correct 5 ms 17244 KB Output is correct
104 Correct 4 ms 17336 KB Output is correct
105 Correct 13 ms 20088 KB Output is correct
106 Correct 13 ms 20060 KB Output is correct
107 Correct 13 ms 20060 KB Output is correct
108 Correct 29 ms 122972 KB Output is correct
109 Correct 115 ms 158292 KB Output is correct
110 Correct 85 ms 140328 KB Output is correct
111 Correct 86 ms 135504 KB Output is correct
112 Correct 109 ms 175952 KB Output is correct
113 Correct 79 ms 144724 KB Output is correct
114 Correct 67 ms 141648 KB Output is correct
115 Correct 28 ms 89424 KB Output is correct
116 Correct 96 ms 189268 KB Output is correct
117 Correct 53 ms 124716 KB Output is correct
118 Correct 39 ms 103000 KB Output is correct
119 Correct 112 ms 198784 KB Output is correct
120 Correct 109 ms 128596 KB Output is correct
121 Correct 101 ms 154428 KB Output is correct
122 Correct 49 ms 109920 KB Output is correct
123 Correct 44 ms 112724 KB Output is correct
124 Correct 50 ms 117828 KB Output is correct
125 Correct 48 ms 132428 KB Output is correct
126 Correct 30 ms 108400 KB Output is correct
127 Correct 79 ms 158036 KB Output is correct
128 Correct 31 ms 105816 KB Output is correct
129 Correct 37 ms 109888 KB Output is correct
130 Correct 28 ms 124508 KB Output is correct
131 Correct 167 ms 206916 KB Output is correct
132 Correct 180 ms 230228 KB Output is correct
133 Correct 183 ms 243280 KB Output is correct
134 Correct 188 ms 254288 KB Output is correct
135 Correct 207 ms 263948 KB Output is correct
136 Correct 209 ms 319316 KB Output is correct
137 Correct 186 ms 302416 KB Output is correct
138 Correct 189 ms 308820 KB Output is correct
139 Correct 198 ms 304204 KB Output is correct
140 Correct 185 ms 309328 KB Output is correct
141 Correct 203 ms 315988 KB Output is correct
142 Correct 175 ms 206928 KB Output is correct
143 Correct 166 ms 244048 KB Output is correct
144 Correct 219 ms 205564 KB Output is correct
145 Correct 166 ms 245312 KB Output is correct
146 Correct 167 ms 206672 KB Output is correct
147 Correct 169 ms 244308 KB Output is correct
148 Correct 160 ms 214984 KB Output is correct
149 Correct 110 ms 203108 KB Output is correct
150 Correct 92 ms 175952 KB Output is correct
151 Correct 70 ms 162128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 10588 KB Output is correct
2 Correct 1 ms 10700 KB Output is correct
3 Correct 1 ms 8536 KB Output is correct
4 Correct 1 ms 8648 KB Output is correct
5 Correct 1 ms 8648 KB Output is correct
6 Correct 2 ms 8540 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 8540 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 2 ms 8536 KB Output is correct
14 Correct 1 ms 8536 KB Output is correct
15 Correct 2 ms 9052 KB Output is correct
16 Correct 2 ms 9052 KB Output is correct
17 Correct 3 ms 9052 KB Output is correct
18 Correct 2 ms 9052 KB Output is correct
19 Correct 2 ms 9052 KB Output is correct
20 Correct 2 ms 9048 KB Output is correct
21 Correct 1 ms 9052 KB Output is correct
22 Correct 2 ms 9052 KB Output is correct
23 Correct 2 ms 9052 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 8 ms 10844 KB Output is correct
26 Correct 8 ms 10844 KB Output is correct
27 Correct 4 ms 8920 KB Output is correct
28 Correct 3 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 2 ms 8796 KB Output is correct
32 Correct 2 ms 8796 KB Output is correct
33 Correct 8 ms 10072 KB Output is correct
34 Correct 5 ms 9856 KB Output is correct
35 Correct 5 ms 10072 KB Output is correct
36 Correct 6 ms 9864 KB Output is correct
37 Correct 6 ms 9988 KB Output is correct
38 Correct 6 ms 10076 KB Output is correct
39 Correct 10 ms 11264 KB Output is correct
40 Correct 10 ms 11352 KB Output is correct
41 Correct 10 ms 11356 KB Output is correct
42 Correct 6 ms 9816 KB Output is correct
43 Correct 4 ms 9308 KB Output is correct
44 Correct 9 ms 9820 KB Output is correct
45 Correct 5 ms 9308 KB Output is correct
46 Correct 5 ms 9304 KB Output is correct
47 Correct 7 ms 10012 KB Output is correct
48 Correct 37 ms 19796 KB Output is correct
49 Correct 19 ms 14684 KB Output is correct
50 Correct 20 ms 18260 KB Output is correct
51 Correct 35 ms 17500 KB Output is correct
52 Correct 25 ms 16732 KB Output is correct
53 Correct 15 ms 14032 KB Output is correct
54 Correct 7 ms 9816 KB Output is correct
55 Correct 7 ms 9820 KB Output is correct
56 Correct 10 ms 9820 KB Output is correct
57 Correct 7 ms 9820 KB Output is correct
58 Correct 7 ms 9948 KB Output is correct
59 Correct 7 ms 9820 KB Output is correct
60 Correct 25 ms 20272 KB Output is correct
61 Correct 25 ms 20316 KB Output is correct
62 Correct 25 ms 20272 KB Output is correct
63 Correct 25 ms 20316 KB Output is correct
64 Correct 45 ms 20236 KB Output is correct
65 Correct 25 ms 20324 KB Output is correct
66 Correct 24 ms 19036 KB Output is correct
67 Correct 25 ms 19036 KB Output is correct
68 Correct 24 ms 19024 KB Output is correct
69 Correct 2 ms 10588 KB Output is correct
70 Correct 2 ms 10588 KB Output is correct
71 Correct 2 ms 10588 KB Output is correct
72 Correct 2 ms 14684 KB Output is correct
73 Correct 2 ms 14828 KB Output is correct
74 Correct 2 ms 14684 KB Output is correct
75 Correct 2 ms 14684 KB Output is correct
76 Correct 2 ms 16732 KB Output is correct
77 Correct 2 ms 14684 KB Output is correct
78 Correct 3 ms 16988 KB Output is correct
79 Correct 3 ms 16732 KB Output is correct
80 Correct 2 ms 14684 KB Output is correct
81 Correct 3 ms 14940 KB Output is correct
82 Correct 2 ms 14904 KB Output is correct
83 Correct 2 ms 10840 KB Output is correct
84 Correct 3 ms 14684 KB Output is correct
85 Correct 2 ms 12632 KB Output is correct
86 Correct 2 ms 14684 KB Output is correct
87 Correct 2 ms 12892 KB Output is correct
88 Correct 2 ms 14940 KB Output is correct
89 Correct 2 ms 16732 KB Output is correct
90 Correct 2 ms 16732 KB Output is correct
91 Correct 2 ms 16732 KB Output is correct
92 Correct 2 ms 16848 KB Output is correct
93 Correct 2 ms 16732 KB Output is correct
94 Correct 2 ms 16732 KB Output is correct
95 Correct 2 ms 16984 KB Output is correct
96 Correct 3 ms 16988 KB Output is correct
97 Correct 3 ms 16988 KB Output is correct
98 Correct 2 ms 16988 KB Output is correct
99 Correct 3 ms 16988 KB Output is correct
100 Correct 3 ms 16988 KB Output is correct
101 Correct 2 ms 14804 KB Output is correct
102 Correct 2 ms 16732 KB Output is correct
103 Correct 3 ms 14940 KB Output is correct
104 Correct 3 ms 16732 KB Output is correct
105 Correct 3 ms 12892 KB Output is correct
106 Correct 2 ms 16728 KB Output is correct
107 Correct 2 ms 14684 KB Output is correct
108 Correct 2 ms 16728 KB Output is correct
109 Correct 2 ms 16732 KB Output is correct
110 Correct 2 ms 16880 KB Output is correct
111 Correct 2 ms 16732 KB Output is correct
112 Correct 3 ms 16988 KB Output is correct
113 Correct 3 ms 16988 KB Output is correct
114 Correct 3 ms 17136 KB Output is correct
115 Correct 3 ms 16988 KB Output is correct
116 Correct 3 ms 14940 KB Output is correct
117 Correct 2 ms 14940 KB Output is correct
118 Correct 10 ms 16988 KB Output is correct
119 Correct 17 ms 17724 KB Output is correct
120 Correct 12 ms 17756 KB Output is correct
121 Correct 3 ms 16908 KB Output is correct
122 Correct 3 ms 16912 KB Output is correct
123 Correct 3 ms 16732 KB Output is correct
124 Correct 3 ms 16796 KB Output is correct
125 Correct 3 ms 16732 KB Output is correct
126 Correct 4 ms 17200 KB Output is correct
127 Correct 4 ms 17236 KB Output is correct
128 Correct 4 ms 17244 KB Output is correct
129 Correct 3 ms 17372 KB Output is correct
130 Correct 5 ms 17244 KB Output is correct
131 Correct 4 ms 17336 KB Output is correct
132 Correct 13 ms 20088 KB Output is correct
133 Correct 13 ms 20060 KB Output is correct
134 Correct 13 ms 20060 KB Output is correct
135 Correct 29 ms 122972 KB Output is correct
136 Correct 115 ms 158292 KB Output is correct
137 Correct 85 ms 140328 KB Output is correct
138 Correct 86 ms 135504 KB Output is correct
139 Correct 109 ms 175952 KB Output is correct
140 Correct 79 ms 144724 KB Output is correct
141 Correct 67 ms 141648 KB Output is correct
142 Correct 28 ms 89424 KB Output is correct
143 Correct 96 ms 189268 KB Output is correct
144 Correct 53 ms 124716 KB Output is correct
145 Correct 39 ms 103000 KB Output is correct
146 Correct 112 ms 198784 KB Output is correct
147 Correct 109 ms 128596 KB Output is correct
148 Correct 101 ms 154428 KB Output is correct
149 Correct 49 ms 109920 KB Output is correct
150 Correct 44 ms 112724 KB Output is correct
151 Correct 50 ms 117828 KB Output is correct
152 Correct 48 ms 132428 KB Output is correct
153 Correct 30 ms 108400 KB Output is correct
154 Correct 79 ms 158036 KB Output is correct
155 Correct 31 ms 105816 KB Output is correct
156 Correct 37 ms 109888 KB Output is correct
157 Correct 28 ms 124508 KB Output is correct
158 Correct 167 ms 206916 KB Output is correct
159 Correct 180 ms 230228 KB Output is correct
160 Correct 183 ms 243280 KB Output is correct
161 Correct 188 ms 254288 KB Output is correct
162 Correct 207 ms 263948 KB Output is correct
163 Correct 209 ms 319316 KB Output is correct
164 Correct 186 ms 302416 KB Output is correct
165 Correct 189 ms 308820 KB Output is correct
166 Correct 198 ms 304204 KB Output is correct
167 Correct 185 ms 309328 KB Output is correct
168 Correct 203 ms 315988 KB Output is correct
169 Correct 175 ms 206928 KB Output is correct
170 Correct 166 ms 244048 KB Output is correct
171 Correct 219 ms 205564 KB Output is correct
172 Correct 166 ms 245312 KB Output is correct
173 Correct 167 ms 206672 KB Output is correct
174 Correct 169 ms 244308 KB Output is correct
175 Correct 160 ms 214984 KB Output is correct
176 Correct 110 ms 203108 KB Output is correct
177 Correct 92 ms 175952 KB Output is correct
178 Correct 70 ms 162128 KB Output is correct
179 Runtime error 222 ms 253988 KB Execution killed with signal 11
180 Halted 0 ms 0 KB -