답안 #910115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
910115 2024-01-17T23:08:21 Z Tigerpants Uplifting Excursion (BOI22_vault) C++17
100 / 100
922 ms 3576 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <set>
#include <map>

using namespace std;

typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

#define rep(i, a, b) for (ll i = a; i < b; i++)
#define rev_rep(i, a, b) for (ll i = a; i >= b; i--)
#define sz(a) (ll) a.size()
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define trav(itr, a, t) for (t::iterator itr = a.begin(); itr != a.end(); itr++)

const ll MAXM = 300LL;
const ll MAXB = MAXM * (2 * MAXM + 1LL);
const ll INF = 1'000'000'000'000'000'000LL;

ll M, L;
vll A;
vll in_greedy;

vll reduce(ll x, ll multiplier = 1) {
    vll res;
    while (x) {
        //cout << "reduce " << x << " " << multiplier << endl;
        res.pb(multiplier);
        x--;
        if (x & 1LL) {
            res.pb(multiplier);
            x--;
        }
        x >>= 1LL;
        multiplier *= 2LL;
    }
    //cout << "ret" << endl;
    return res;
}

int main() {
    cin.tie(NULL)->sync_with_stdio(false);

    cin >> M >> L;
    A.resize(2 * M + 1);
    rep(i, 0, 2 * M + 1) cin >> A[i];

    ll s = 0LL;
    rep(i, -M, M + 1) {
        s += A[i + M] * i;
    }
    if (s < L) { // reverse the problem
        //cout << "reverse " << s << endl;
        rep(i, 1, M + 1) swap(A[M - i], A[M + i]);
        L *= -1;
    }

    // greedy
    in_greedy.resize(M + 1, 0);
    s = 0LL;
    ll n = 0LL;
    rep(i, -M, 1) {
        s += A[i + M] * i;
        n += A[i + M];
    }
    //cout << L << " " << s << " " << n << endl;
    rep(i, 1, M + 1) {
        //cout << i << " " << L << " " << s << " " << ((L - s) / i) << " " << A[i + M] << endl;
        in_greedy[i] = max<ll>(0LL, min<ll>((L - s) / i, A[i + M]));
        //cout << in_greedy[i] << endl;
        //cout << i << " -> " << in_greedy[i] << endl;
        s += in_greedy[i] * i;
        n += in_greedy[i];
    }
    //cout << "n=" << n << endl;

    // dp
    ll dp[2 * MAXB + 1];
    rep(i, 0, 2 * MAXB + 1) dp[i] = -INF;
    //cout << (L - s) << " [" << -MAXB << ", " << MAXB << "]" << endl;
    if ((L - s >= -MAXB) && (L - s <= MAXB)) dp[MAXB + (L - s)] = n; // base case

    /* rep(i, -10, 11) {
        cout << dp[i + MAXB] << " ";
    }
    cout << endl; */

    rep(w, 1, M + 1) {
        // add w
        //cout << (2 * M) << " " << A[w + M] << " " << in_greedy[w] << endl;
        vll deltas = reduce(min<ll>(2 * M, A[w + M] - in_greedy[w]));
        /* cout << min<ll>(2 * M, A[w + M] - in_greedy[w]) << " -> {";
        trav(delta, deltas, vll) cout << (*delta) << " ";
        cout << "}" << endl; */
        trav(delta, deltas, vll) {
            rep(i, - MAXB, MAXB + 1 - (*delta) * w) {
                dp[i + MAXB] = max<ll>(dp[i + MAXB], dp[i + MAXB + (*delta) * w] + (*delta));
            }
        }

        // remove w
        //deltas = reduce(min<ll>(2 * M, in_greedy[w]), -1);
        deltas = reduce(min<ll>(2 * M, in_greedy[w]), -1);
        /* cout << min<ll>(2 * M, in_greedy[w]) << " -> {";
        trav(delta, deltas, vll) cout << (*delta) << " ";
        cout << "}" << endl; */
        trav(delta, deltas, vll) {
            rev_rep(i, MAXB, - MAXB - (*delta) * w) {
                //cout << (*delta) << " " << i + MAXB - (*delta) << " " << 2 * MAXB << endl;
                dp[i + MAXB] = max<ll>(dp[i + MAXB], dp[i + MAXB + (*delta) * w] + (*delta));
            }
        }

        /* rep(i, -10, 11) {
            cout << dp[i + MAXB] << " ";
        }
        cout << endl; */
    }

    if (dp[MAXB] < 0) {
        cout << "impossible" << endl;
    } else {
        cout << dp[MAXB] << endl;
    }

    return 0;
}

// the dp covers the range of uplifts [L - M - 2M^2, L + M + 2M^2]
// in each step, we consider adding up to min<ll>(2 * M, A[w + M] - in_greedy[w]) of weight w, or removng up to min<ll>(2 * M, in_greedy[w])
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3160 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 3 ms 3272 KB Output is correct
4 Correct 10 ms 3164 KB Output is correct
5 Correct 74 ms 3164 KB Output is correct
6 Correct 79 ms 3164 KB Output is correct
7 Correct 43 ms 3244 KB Output is correct
8 Correct 80 ms 3244 KB Output is correct
9 Correct 108 ms 3160 KB Output is correct
10 Correct 6 ms 3160 KB Output is correct
11 Correct 8 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3160 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 3 ms 3272 KB Output is correct
4 Correct 10 ms 3164 KB Output is correct
5 Correct 74 ms 3164 KB Output is correct
6 Correct 79 ms 3164 KB Output is correct
7 Correct 43 ms 3244 KB Output is correct
8 Correct 80 ms 3244 KB Output is correct
9 Correct 108 ms 3160 KB Output is correct
10 Correct 6 ms 3160 KB Output is correct
11 Correct 8 ms 3164 KB Output is correct
12 Correct 3 ms 3164 KB Output is correct
13 Correct 3 ms 3164 KB Output is correct
14 Correct 3 ms 3164 KB Output is correct
15 Correct 10 ms 3160 KB Output is correct
16 Correct 74 ms 3164 KB Output is correct
17 Correct 79 ms 3160 KB Output is correct
18 Correct 43 ms 3160 KB Output is correct
19 Correct 80 ms 3164 KB Output is correct
20 Correct 100 ms 3248 KB Output is correct
21 Correct 6 ms 3168 KB Output is correct
22 Correct 8 ms 3164 KB Output is correct
23 Correct 198 ms 3252 KB Output is correct
24 Correct 228 ms 3160 KB Output is correct
25 Correct 90 ms 3160 KB Output is correct
26 Correct 218 ms 3416 KB Output is correct
27 Correct 221 ms 3264 KB Output is correct
28 Correct 7 ms 3160 KB Output is correct
29 Correct 12 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3160 KB Output is correct
2 Correct 55 ms 3248 KB Output is correct
3 Correct 18 ms 3164 KB Output is correct
4 Correct 58 ms 3164 KB Output is correct
5 Correct 63 ms 3164 KB Output is correct
6 Correct 48 ms 3160 KB Output is correct
7 Correct 12 ms 3164 KB Output is correct
8 Correct 10 ms 3160 KB Output is correct
9 Correct 35 ms 3256 KB Output is correct
10 Correct 40 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3160 KB Output is correct
2 Correct 55 ms 3248 KB Output is correct
3 Correct 18 ms 3164 KB Output is correct
4 Correct 58 ms 3164 KB Output is correct
5 Correct 63 ms 3164 KB Output is correct
6 Correct 48 ms 3160 KB Output is correct
7 Correct 12 ms 3164 KB Output is correct
8 Correct 10 ms 3160 KB Output is correct
9 Correct 35 ms 3256 KB Output is correct
10 Correct 40 ms 3164 KB Output is correct
11 Correct 3 ms 3164 KB Output is correct
12 Correct 3 ms 3164 KB Output is correct
13 Correct 3 ms 3164 KB Output is correct
14 Correct 10 ms 3164 KB Output is correct
15 Correct 55 ms 3216 KB Output is correct
16 Correct 18 ms 3160 KB Output is correct
17 Correct 58 ms 3160 KB Output is correct
18 Correct 63 ms 3160 KB Output is correct
19 Correct 48 ms 3160 KB Output is correct
20 Correct 11 ms 3160 KB Output is correct
21 Correct 8 ms 3164 KB Output is correct
22 Correct 26 ms 3160 KB Output is correct
23 Correct 40 ms 3164 KB Output is correct
24 Correct 54 ms 3160 KB Output is correct
25 Correct 21 ms 3164 KB Output is correct
26 Correct 64 ms 3252 KB Output is correct
27 Correct 62 ms 3164 KB Output is correct
28 Correct 52 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3160 KB Output is correct
2 Correct 55 ms 3248 KB Output is correct
3 Correct 18 ms 3164 KB Output is correct
4 Correct 58 ms 3164 KB Output is correct
5 Correct 63 ms 3164 KB Output is correct
6 Correct 48 ms 3160 KB Output is correct
7 Correct 12 ms 3164 KB Output is correct
8 Correct 10 ms 3160 KB Output is correct
9 Correct 35 ms 3256 KB Output is correct
10 Correct 40 ms 3164 KB Output is correct
11 Correct 10 ms 3164 KB Output is correct
12 Correct 56 ms 3164 KB Output is correct
13 Correct 20 ms 3164 KB Output is correct
14 Correct 58 ms 3164 KB Output is correct
15 Correct 64 ms 3160 KB Output is correct
16 Correct 49 ms 3164 KB Output is correct
17 Correct 8 ms 3164 KB Output is correct
18 Correct 10 ms 3164 KB Output is correct
19 Correct 26 ms 3272 KB Output is correct
20 Correct 39 ms 3160 KB Output is correct
21 Correct 6 ms 3164 KB Output is correct
22 Correct 8 ms 3272 KB Output is correct
23 Correct 98 ms 3248 KB Output is correct
24 Correct 45 ms 3172 KB Output is correct
25 Correct 103 ms 3408 KB Output is correct
26 Correct 113 ms 3160 KB Output is correct
27 Correct 98 ms 3164 KB Output is correct
28 Correct 94 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3160 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 3 ms 3272 KB Output is correct
4 Correct 10 ms 3164 KB Output is correct
5 Correct 74 ms 3164 KB Output is correct
6 Correct 79 ms 3164 KB Output is correct
7 Correct 43 ms 3244 KB Output is correct
8 Correct 80 ms 3244 KB Output is correct
9 Correct 108 ms 3160 KB Output is correct
10 Correct 6 ms 3160 KB Output is correct
11 Correct 8 ms 3164 KB Output is correct
12 Correct 10 ms 3160 KB Output is correct
13 Correct 55 ms 3248 KB Output is correct
14 Correct 18 ms 3164 KB Output is correct
15 Correct 58 ms 3164 KB Output is correct
16 Correct 63 ms 3164 KB Output is correct
17 Correct 48 ms 3160 KB Output is correct
18 Correct 12 ms 3164 KB Output is correct
19 Correct 10 ms 3160 KB Output is correct
20 Correct 35 ms 3256 KB Output is correct
21 Correct 40 ms 3164 KB Output is correct
22 Correct 3 ms 3164 KB Output is correct
23 Correct 3 ms 3164 KB Output is correct
24 Correct 3 ms 3164 KB Output is correct
25 Correct 10 ms 3164 KB Output is correct
26 Correct 55 ms 3216 KB Output is correct
27 Correct 18 ms 3160 KB Output is correct
28 Correct 58 ms 3160 KB Output is correct
29 Correct 63 ms 3160 KB Output is correct
30 Correct 48 ms 3160 KB Output is correct
31 Correct 11 ms 3160 KB Output is correct
32 Correct 8 ms 3164 KB Output is correct
33 Correct 26 ms 3160 KB Output is correct
34 Correct 40 ms 3164 KB Output is correct
35 Correct 54 ms 3160 KB Output is correct
36 Correct 21 ms 3164 KB Output is correct
37 Correct 64 ms 3252 KB Output is correct
38 Correct 62 ms 3164 KB Output is correct
39 Correct 52 ms 3164 KB Output is correct
40 Correct 10 ms 3164 KB Output is correct
41 Correct 56 ms 3164 KB Output is correct
42 Correct 20 ms 3164 KB Output is correct
43 Correct 58 ms 3164 KB Output is correct
44 Correct 64 ms 3160 KB Output is correct
45 Correct 49 ms 3164 KB Output is correct
46 Correct 8 ms 3164 KB Output is correct
47 Correct 10 ms 3164 KB Output is correct
48 Correct 26 ms 3272 KB Output is correct
49 Correct 39 ms 3160 KB Output is correct
50 Correct 6 ms 3164 KB Output is correct
51 Correct 8 ms 3272 KB Output is correct
52 Correct 98 ms 3248 KB Output is correct
53 Correct 45 ms 3172 KB Output is correct
54 Correct 103 ms 3408 KB Output is correct
55 Correct 113 ms 3160 KB Output is correct
56 Correct 98 ms 3164 KB Output is correct
57 Correct 94 ms 3164 KB Output is correct
58 Correct 3 ms 3164 KB Output is correct
59 Correct 3 ms 3164 KB Output is correct
60 Correct 3 ms 3164 KB Output is correct
61 Correct 10 ms 3164 KB Output is correct
62 Correct 75 ms 3160 KB Output is correct
63 Correct 80 ms 3252 KB Output is correct
64 Correct 41 ms 3164 KB Output is correct
65 Correct 84 ms 3248 KB Output is correct
66 Correct 106 ms 3256 KB Output is correct
67 Correct 6 ms 3160 KB Output is correct
68 Correct 12 ms 3416 KB Output is correct
69 Correct 55 ms 3416 KB Output is correct
70 Correct 17 ms 3160 KB Output is correct
71 Correct 59 ms 3164 KB Output is correct
72 Correct 73 ms 3252 KB Output is correct
73 Correct 48 ms 3160 KB Output is correct
74 Correct 8 ms 3160 KB Output is correct
75 Correct 8 ms 3268 KB Output is correct
76 Correct 26 ms 3276 KB Output is correct
77 Correct 40 ms 3164 KB Output is correct
78 Correct 55 ms 3164 KB Output is correct
79 Correct 22 ms 3164 KB Output is correct
80 Correct 65 ms 3160 KB Output is correct
81 Correct 51 ms 3164 KB Output is correct
82 Correct 63 ms 3260 KB Output is correct
83 Correct 94 ms 3248 KB Output is correct
84 Correct 45 ms 3164 KB Output is correct
85 Correct 92 ms 3248 KB Output is correct
86 Correct 114 ms 3160 KB Output is correct
87 Correct 97 ms 3252 KB Output is correct
88 Correct 78 ms 3164 KB Output is correct
89 Correct 90 ms 3160 KB Output is correct
90 Correct 116 ms 3416 KB Output is correct
91 Correct 88 ms 3164 KB Output is correct
92 Correct 102 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3160 KB Output is correct
2 Correct 55 ms 3248 KB Output is correct
3 Correct 18 ms 3164 KB Output is correct
4 Correct 58 ms 3164 KB Output is correct
5 Correct 63 ms 3164 KB Output is correct
6 Correct 48 ms 3160 KB Output is correct
7 Correct 12 ms 3164 KB Output is correct
8 Correct 10 ms 3160 KB Output is correct
9 Correct 35 ms 3256 KB Output is correct
10 Correct 40 ms 3164 KB Output is correct
11 Correct 10 ms 3164 KB Output is correct
12 Correct 56 ms 3164 KB Output is correct
13 Correct 20 ms 3164 KB Output is correct
14 Correct 58 ms 3164 KB Output is correct
15 Correct 64 ms 3160 KB Output is correct
16 Correct 49 ms 3164 KB Output is correct
17 Correct 8 ms 3164 KB Output is correct
18 Correct 10 ms 3164 KB Output is correct
19 Correct 26 ms 3272 KB Output is correct
20 Correct 39 ms 3160 KB Output is correct
21 Correct 6 ms 3164 KB Output is correct
22 Correct 8 ms 3272 KB Output is correct
23 Correct 98 ms 3248 KB Output is correct
24 Correct 45 ms 3172 KB Output is correct
25 Correct 103 ms 3408 KB Output is correct
26 Correct 113 ms 3160 KB Output is correct
27 Correct 98 ms 3164 KB Output is correct
28 Correct 94 ms 3164 KB Output is correct
29 Correct 10 ms 3164 KB Output is correct
30 Correct 54 ms 3164 KB Output is correct
31 Correct 18 ms 3160 KB Output is correct
32 Correct 60 ms 3164 KB Output is correct
33 Correct 69 ms 3164 KB Output is correct
34 Correct 48 ms 3164 KB Output is correct
35 Correct 13 ms 3420 KB Output is correct
36 Correct 8 ms 3160 KB Output is correct
37 Correct 26 ms 3164 KB Output is correct
38 Correct 40 ms 3164 KB Output is correct
39 Correct 6 ms 3164 KB Output is correct
40 Correct 8 ms 3164 KB Output is correct
41 Correct 93 ms 3256 KB Output is correct
42 Correct 50 ms 3412 KB Output is correct
43 Correct 92 ms 3248 KB Output is correct
44 Correct 114 ms 3164 KB Output is correct
45 Correct 98 ms 3164 KB Output is correct
46 Correct 78 ms 3160 KB Output is correct
47 Correct 7 ms 3160 KB Output is correct
48 Correct 10 ms 3276 KB Output is correct
49 Correct 210 ms 3160 KB Output is correct
50 Correct 91 ms 3160 KB Output is correct
51 Correct 256 ms 3256 KB Output is correct
52 Correct 241 ms 3160 KB Output is correct
53 Correct 217 ms 3252 KB Output is correct
54 Correct 190 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3160 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 3 ms 3272 KB Output is correct
4 Correct 10 ms 3164 KB Output is correct
5 Correct 74 ms 3164 KB Output is correct
6 Correct 79 ms 3164 KB Output is correct
7 Correct 43 ms 3244 KB Output is correct
8 Correct 80 ms 3244 KB Output is correct
9 Correct 108 ms 3160 KB Output is correct
10 Correct 6 ms 3160 KB Output is correct
11 Correct 8 ms 3164 KB Output is correct
12 Correct 3 ms 3164 KB Output is correct
13 Correct 3 ms 3164 KB Output is correct
14 Correct 3 ms 3164 KB Output is correct
15 Correct 10 ms 3160 KB Output is correct
16 Correct 74 ms 3164 KB Output is correct
17 Correct 79 ms 3160 KB Output is correct
18 Correct 43 ms 3160 KB Output is correct
19 Correct 80 ms 3164 KB Output is correct
20 Correct 100 ms 3248 KB Output is correct
21 Correct 6 ms 3168 KB Output is correct
22 Correct 8 ms 3164 KB Output is correct
23 Correct 198 ms 3252 KB Output is correct
24 Correct 228 ms 3160 KB Output is correct
25 Correct 90 ms 3160 KB Output is correct
26 Correct 218 ms 3416 KB Output is correct
27 Correct 221 ms 3264 KB Output is correct
28 Correct 7 ms 3160 KB Output is correct
29 Correct 12 ms 3160 KB Output is correct
30 Correct 10 ms 3160 KB Output is correct
31 Correct 55 ms 3248 KB Output is correct
32 Correct 18 ms 3164 KB Output is correct
33 Correct 58 ms 3164 KB Output is correct
34 Correct 63 ms 3164 KB Output is correct
35 Correct 48 ms 3160 KB Output is correct
36 Correct 12 ms 3164 KB Output is correct
37 Correct 10 ms 3160 KB Output is correct
38 Correct 35 ms 3256 KB Output is correct
39 Correct 40 ms 3164 KB Output is correct
40 Correct 3 ms 3164 KB Output is correct
41 Correct 3 ms 3164 KB Output is correct
42 Correct 3 ms 3164 KB Output is correct
43 Correct 10 ms 3164 KB Output is correct
44 Correct 55 ms 3216 KB Output is correct
45 Correct 18 ms 3160 KB Output is correct
46 Correct 58 ms 3160 KB Output is correct
47 Correct 63 ms 3160 KB Output is correct
48 Correct 48 ms 3160 KB Output is correct
49 Correct 11 ms 3160 KB Output is correct
50 Correct 8 ms 3164 KB Output is correct
51 Correct 26 ms 3160 KB Output is correct
52 Correct 40 ms 3164 KB Output is correct
53 Correct 54 ms 3160 KB Output is correct
54 Correct 21 ms 3164 KB Output is correct
55 Correct 64 ms 3252 KB Output is correct
56 Correct 62 ms 3164 KB Output is correct
57 Correct 52 ms 3164 KB Output is correct
58 Correct 10 ms 3164 KB Output is correct
59 Correct 56 ms 3164 KB Output is correct
60 Correct 20 ms 3164 KB Output is correct
61 Correct 58 ms 3164 KB Output is correct
62 Correct 64 ms 3160 KB Output is correct
63 Correct 49 ms 3164 KB Output is correct
64 Correct 8 ms 3164 KB Output is correct
65 Correct 10 ms 3164 KB Output is correct
66 Correct 26 ms 3272 KB Output is correct
67 Correct 39 ms 3160 KB Output is correct
68 Correct 6 ms 3164 KB Output is correct
69 Correct 8 ms 3272 KB Output is correct
70 Correct 98 ms 3248 KB Output is correct
71 Correct 45 ms 3172 KB Output is correct
72 Correct 103 ms 3408 KB Output is correct
73 Correct 113 ms 3160 KB Output is correct
74 Correct 98 ms 3164 KB Output is correct
75 Correct 94 ms 3164 KB Output is correct
76 Correct 3 ms 3164 KB Output is correct
77 Correct 3 ms 3164 KB Output is correct
78 Correct 3 ms 3164 KB Output is correct
79 Correct 10 ms 3164 KB Output is correct
80 Correct 75 ms 3160 KB Output is correct
81 Correct 80 ms 3252 KB Output is correct
82 Correct 41 ms 3164 KB Output is correct
83 Correct 84 ms 3248 KB Output is correct
84 Correct 106 ms 3256 KB Output is correct
85 Correct 6 ms 3160 KB Output is correct
86 Correct 12 ms 3416 KB Output is correct
87 Correct 55 ms 3416 KB Output is correct
88 Correct 17 ms 3160 KB Output is correct
89 Correct 59 ms 3164 KB Output is correct
90 Correct 73 ms 3252 KB Output is correct
91 Correct 48 ms 3160 KB Output is correct
92 Correct 8 ms 3160 KB Output is correct
93 Correct 8 ms 3268 KB Output is correct
94 Correct 26 ms 3276 KB Output is correct
95 Correct 40 ms 3164 KB Output is correct
96 Correct 55 ms 3164 KB Output is correct
97 Correct 22 ms 3164 KB Output is correct
98 Correct 65 ms 3160 KB Output is correct
99 Correct 51 ms 3164 KB Output is correct
100 Correct 63 ms 3260 KB Output is correct
101 Correct 94 ms 3248 KB Output is correct
102 Correct 45 ms 3164 KB Output is correct
103 Correct 92 ms 3248 KB Output is correct
104 Correct 114 ms 3160 KB Output is correct
105 Correct 97 ms 3252 KB Output is correct
106 Correct 78 ms 3164 KB Output is correct
107 Correct 90 ms 3160 KB Output is correct
108 Correct 116 ms 3416 KB Output is correct
109 Correct 88 ms 3164 KB Output is correct
110 Correct 102 ms 3164 KB Output is correct
111 Correct 10 ms 3164 KB Output is correct
112 Correct 54 ms 3164 KB Output is correct
113 Correct 18 ms 3160 KB Output is correct
114 Correct 60 ms 3164 KB Output is correct
115 Correct 69 ms 3164 KB Output is correct
116 Correct 48 ms 3164 KB Output is correct
117 Correct 13 ms 3420 KB Output is correct
118 Correct 8 ms 3160 KB Output is correct
119 Correct 26 ms 3164 KB Output is correct
120 Correct 40 ms 3164 KB Output is correct
121 Correct 6 ms 3164 KB Output is correct
122 Correct 8 ms 3164 KB Output is correct
123 Correct 93 ms 3256 KB Output is correct
124 Correct 50 ms 3412 KB Output is correct
125 Correct 92 ms 3248 KB Output is correct
126 Correct 114 ms 3164 KB Output is correct
127 Correct 98 ms 3164 KB Output is correct
128 Correct 78 ms 3160 KB Output is correct
129 Correct 7 ms 3160 KB Output is correct
130 Correct 10 ms 3276 KB Output is correct
131 Correct 210 ms 3160 KB Output is correct
132 Correct 91 ms 3160 KB Output is correct
133 Correct 256 ms 3256 KB Output is correct
134 Correct 241 ms 3160 KB Output is correct
135 Correct 217 ms 3252 KB Output is correct
136 Correct 190 ms 3164 KB Output is correct
137 Correct 3 ms 3160 KB Output is correct
138 Correct 4 ms 3160 KB Output is correct
139 Correct 3 ms 3164 KB Output is correct
140 Correct 10 ms 3280 KB Output is correct
141 Correct 78 ms 3164 KB Output is correct
142 Correct 79 ms 3164 KB Output is correct
143 Correct 40 ms 3164 KB Output is correct
144 Correct 105 ms 3160 KB Output is correct
145 Correct 100 ms 3164 KB Output is correct
146 Correct 7 ms 3164 KB Output is correct
147 Correct 11 ms 3420 KB Output is correct
148 Correct 201 ms 3164 KB Output is correct
149 Correct 197 ms 3164 KB Output is correct
150 Correct 78 ms 3164 KB Output is correct
151 Correct 219 ms 3576 KB Output is correct
152 Correct 214 ms 3256 KB Output is correct
153 Correct 7 ms 3164 KB Output is correct
154 Correct 10 ms 3160 KB Output is correct
155 Correct 55 ms 3164 KB Output is correct
156 Correct 18 ms 3160 KB Output is correct
157 Correct 59 ms 3160 KB Output is correct
158 Correct 85 ms 3252 KB Output is correct
159 Correct 48 ms 3160 KB Output is correct
160 Correct 9 ms 3160 KB Output is correct
161 Correct 9 ms 3276 KB Output is correct
162 Correct 26 ms 3160 KB Output is correct
163 Correct 40 ms 3248 KB Output is correct
164 Correct 92 ms 3252 KB Output is correct
165 Correct 45 ms 3164 KB Output is correct
166 Correct 94 ms 3164 KB Output is correct
167 Correct 112 ms 3160 KB Output is correct
168 Correct 98 ms 3248 KB Output is correct
169 Correct 77 ms 3160 KB Output is correct
170 Correct 60 ms 3160 KB Output is correct
171 Correct 22 ms 3160 KB Output is correct
172 Correct 64 ms 3256 KB Output is correct
173 Correct 50 ms 3160 KB Output is correct
174 Correct 52 ms 3248 KB Output is correct
175 Correct 90 ms 3160 KB Output is correct
176 Correct 120 ms 3256 KB Output is correct
177 Correct 88 ms 3252 KB Output is correct
178 Correct 102 ms 3160 KB Output is correct
179 Correct 217 ms 3164 KB Output is correct
180 Correct 93 ms 3160 KB Output is correct
181 Correct 229 ms 3160 KB Output is correct
182 Correct 238 ms 3252 KB Output is correct
183 Correct 213 ms 3160 KB Output is correct
184 Correct 181 ms 3256 KB Output is correct
185 Correct 216 ms 3256 KB Output is correct
186 Correct 237 ms 3412 KB Output is correct
187 Correct 212 ms 3164 KB Output is correct
188 Correct 236 ms 3256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 3160 KB Output is correct
2 Correct 55 ms 3248 KB Output is correct
3 Correct 18 ms 3164 KB Output is correct
4 Correct 58 ms 3164 KB Output is correct
5 Correct 63 ms 3164 KB Output is correct
6 Correct 48 ms 3160 KB Output is correct
7 Correct 12 ms 3164 KB Output is correct
8 Correct 10 ms 3160 KB Output is correct
9 Correct 35 ms 3256 KB Output is correct
10 Correct 40 ms 3164 KB Output is correct
11 Correct 10 ms 3164 KB Output is correct
12 Correct 56 ms 3164 KB Output is correct
13 Correct 20 ms 3164 KB Output is correct
14 Correct 58 ms 3164 KB Output is correct
15 Correct 64 ms 3160 KB Output is correct
16 Correct 49 ms 3164 KB Output is correct
17 Correct 8 ms 3164 KB Output is correct
18 Correct 10 ms 3164 KB Output is correct
19 Correct 26 ms 3272 KB Output is correct
20 Correct 39 ms 3160 KB Output is correct
21 Correct 6 ms 3164 KB Output is correct
22 Correct 8 ms 3272 KB Output is correct
23 Correct 98 ms 3248 KB Output is correct
24 Correct 45 ms 3172 KB Output is correct
25 Correct 103 ms 3408 KB Output is correct
26 Correct 113 ms 3160 KB Output is correct
27 Correct 98 ms 3164 KB Output is correct
28 Correct 94 ms 3164 KB Output is correct
29 Correct 10 ms 3164 KB Output is correct
30 Correct 54 ms 3164 KB Output is correct
31 Correct 18 ms 3160 KB Output is correct
32 Correct 60 ms 3164 KB Output is correct
33 Correct 69 ms 3164 KB Output is correct
34 Correct 48 ms 3164 KB Output is correct
35 Correct 13 ms 3420 KB Output is correct
36 Correct 8 ms 3160 KB Output is correct
37 Correct 26 ms 3164 KB Output is correct
38 Correct 40 ms 3164 KB Output is correct
39 Correct 6 ms 3164 KB Output is correct
40 Correct 8 ms 3164 KB Output is correct
41 Correct 93 ms 3256 KB Output is correct
42 Correct 50 ms 3412 KB Output is correct
43 Correct 92 ms 3248 KB Output is correct
44 Correct 114 ms 3164 KB Output is correct
45 Correct 98 ms 3164 KB Output is correct
46 Correct 78 ms 3160 KB Output is correct
47 Correct 7 ms 3160 KB Output is correct
48 Correct 10 ms 3276 KB Output is correct
49 Correct 210 ms 3160 KB Output is correct
50 Correct 91 ms 3160 KB Output is correct
51 Correct 256 ms 3256 KB Output is correct
52 Correct 241 ms 3160 KB Output is correct
53 Correct 217 ms 3252 KB Output is correct
54 Correct 190 ms 3164 KB Output is correct
55 Correct 10 ms 3272 KB Output is correct
56 Correct 54 ms 3160 KB Output is correct
57 Correct 18 ms 3160 KB Output is correct
58 Correct 76 ms 3164 KB Output is correct
59 Correct 64 ms 3160 KB Output is correct
60 Correct 47 ms 3164 KB Output is correct
61 Correct 9 ms 3164 KB Output is correct
62 Correct 8 ms 3160 KB Output is correct
63 Correct 26 ms 3160 KB Output is correct
64 Correct 42 ms 3260 KB Output is correct
65 Correct 6 ms 3160 KB Output is correct
66 Correct 8 ms 3164 KB Output is correct
67 Correct 92 ms 3164 KB Output is correct
68 Correct 44 ms 3248 KB Output is correct
69 Correct 95 ms 3160 KB Output is correct
70 Correct 112 ms 3252 KB Output is correct
71 Correct 102 ms 3160 KB Output is correct
72 Correct 80 ms 3164 KB Output is correct
73 Correct 7 ms 3160 KB Output is correct
74 Correct 9 ms 3164 KB Output is correct
75 Correct 211 ms 3256 KB Output is correct
76 Correct 105 ms 3248 KB Output is correct
77 Correct 265 ms 3512 KB Output is correct
78 Correct 242 ms 3160 KB Output is correct
79 Correct 243 ms 3160 KB Output is correct
80 Correct 184 ms 3412 KB Output is correct
81 Correct 842 ms 3264 KB Output is correct
82 Correct 367 ms 3164 KB Output is correct
83 Correct 836 ms 3280 KB Output is correct
84 Correct 922 ms 3160 KB Output is correct
85 Correct 11 ms 3164 KB Output is correct
86 Correct 11 ms 3164 KB Output is correct
87 Correct 744 ms 3260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3160 KB Output is correct
2 Correct 3 ms 3164 KB Output is correct
3 Correct 3 ms 3272 KB Output is correct
4 Correct 10 ms 3164 KB Output is correct
5 Correct 74 ms 3164 KB Output is correct
6 Correct 79 ms 3164 KB Output is correct
7 Correct 43 ms 3244 KB Output is correct
8 Correct 80 ms 3244 KB Output is correct
9 Correct 108 ms 3160 KB Output is correct
10 Correct 6 ms 3160 KB Output is correct
11 Correct 8 ms 3164 KB Output is correct
12 Correct 3 ms 3164 KB Output is correct
13 Correct 3 ms 3164 KB Output is correct
14 Correct 3 ms 3164 KB Output is correct
15 Correct 10 ms 3160 KB Output is correct
16 Correct 74 ms 3164 KB Output is correct
17 Correct 79 ms 3160 KB Output is correct
18 Correct 43 ms 3160 KB Output is correct
19 Correct 80 ms 3164 KB Output is correct
20 Correct 100 ms 3248 KB Output is correct
21 Correct 6 ms 3168 KB Output is correct
22 Correct 8 ms 3164 KB Output is correct
23 Correct 198 ms 3252 KB Output is correct
24 Correct 228 ms 3160 KB Output is correct
25 Correct 90 ms 3160 KB Output is correct
26 Correct 218 ms 3416 KB Output is correct
27 Correct 221 ms 3264 KB Output is correct
28 Correct 7 ms 3160 KB Output is correct
29 Correct 12 ms 3160 KB Output is correct
30 Correct 10 ms 3160 KB Output is correct
31 Correct 55 ms 3248 KB Output is correct
32 Correct 18 ms 3164 KB Output is correct
33 Correct 58 ms 3164 KB Output is correct
34 Correct 63 ms 3164 KB Output is correct
35 Correct 48 ms 3160 KB Output is correct
36 Correct 12 ms 3164 KB Output is correct
37 Correct 10 ms 3160 KB Output is correct
38 Correct 35 ms 3256 KB Output is correct
39 Correct 40 ms 3164 KB Output is correct
40 Correct 3 ms 3164 KB Output is correct
41 Correct 3 ms 3164 KB Output is correct
42 Correct 3 ms 3164 KB Output is correct
43 Correct 10 ms 3164 KB Output is correct
44 Correct 55 ms 3216 KB Output is correct
45 Correct 18 ms 3160 KB Output is correct
46 Correct 58 ms 3160 KB Output is correct
47 Correct 63 ms 3160 KB Output is correct
48 Correct 48 ms 3160 KB Output is correct
49 Correct 11 ms 3160 KB Output is correct
50 Correct 8 ms 3164 KB Output is correct
51 Correct 26 ms 3160 KB Output is correct
52 Correct 40 ms 3164 KB Output is correct
53 Correct 54 ms 3160 KB Output is correct
54 Correct 21 ms 3164 KB Output is correct
55 Correct 64 ms 3252 KB Output is correct
56 Correct 62 ms 3164 KB Output is correct
57 Correct 52 ms 3164 KB Output is correct
58 Correct 10 ms 3164 KB Output is correct
59 Correct 56 ms 3164 KB Output is correct
60 Correct 20 ms 3164 KB Output is correct
61 Correct 58 ms 3164 KB Output is correct
62 Correct 64 ms 3160 KB Output is correct
63 Correct 49 ms 3164 KB Output is correct
64 Correct 8 ms 3164 KB Output is correct
65 Correct 10 ms 3164 KB Output is correct
66 Correct 26 ms 3272 KB Output is correct
67 Correct 39 ms 3160 KB Output is correct
68 Correct 6 ms 3164 KB Output is correct
69 Correct 8 ms 3272 KB Output is correct
70 Correct 98 ms 3248 KB Output is correct
71 Correct 45 ms 3172 KB Output is correct
72 Correct 103 ms 3408 KB Output is correct
73 Correct 113 ms 3160 KB Output is correct
74 Correct 98 ms 3164 KB Output is correct
75 Correct 94 ms 3164 KB Output is correct
76 Correct 3 ms 3164 KB Output is correct
77 Correct 3 ms 3164 KB Output is correct
78 Correct 3 ms 3164 KB Output is correct
79 Correct 10 ms 3164 KB Output is correct
80 Correct 75 ms 3160 KB Output is correct
81 Correct 80 ms 3252 KB Output is correct
82 Correct 41 ms 3164 KB Output is correct
83 Correct 84 ms 3248 KB Output is correct
84 Correct 106 ms 3256 KB Output is correct
85 Correct 6 ms 3160 KB Output is correct
86 Correct 12 ms 3416 KB Output is correct
87 Correct 55 ms 3416 KB Output is correct
88 Correct 17 ms 3160 KB Output is correct
89 Correct 59 ms 3164 KB Output is correct
90 Correct 73 ms 3252 KB Output is correct
91 Correct 48 ms 3160 KB Output is correct
92 Correct 8 ms 3160 KB Output is correct
93 Correct 8 ms 3268 KB Output is correct
94 Correct 26 ms 3276 KB Output is correct
95 Correct 40 ms 3164 KB Output is correct
96 Correct 55 ms 3164 KB Output is correct
97 Correct 22 ms 3164 KB Output is correct
98 Correct 65 ms 3160 KB Output is correct
99 Correct 51 ms 3164 KB Output is correct
100 Correct 63 ms 3260 KB Output is correct
101 Correct 94 ms 3248 KB Output is correct
102 Correct 45 ms 3164 KB Output is correct
103 Correct 92 ms 3248 KB Output is correct
104 Correct 114 ms 3160 KB Output is correct
105 Correct 97 ms 3252 KB Output is correct
106 Correct 78 ms 3164 KB Output is correct
107 Correct 90 ms 3160 KB Output is correct
108 Correct 116 ms 3416 KB Output is correct
109 Correct 88 ms 3164 KB Output is correct
110 Correct 102 ms 3164 KB Output is correct
111 Correct 10 ms 3164 KB Output is correct
112 Correct 54 ms 3164 KB Output is correct
113 Correct 18 ms 3160 KB Output is correct
114 Correct 60 ms 3164 KB Output is correct
115 Correct 69 ms 3164 KB Output is correct
116 Correct 48 ms 3164 KB Output is correct
117 Correct 13 ms 3420 KB Output is correct
118 Correct 8 ms 3160 KB Output is correct
119 Correct 26 ms 3164 KB Output is correct
120 Correct 40 ms 3164 KB Output is correct
121 Correct 6 ms 3164 KB Output is correct
122 Correct 8 ms 3164 KB Output is correct
123 Correct 93 ms 3256 KB Output is correct
124 Correct 50 ms 3412 KB Output is correct
125 Correct 92 ms 3248 KB Output is correct
126 Correct 114 ms 3164 KB Output is correct
127 Correct 98 ms 3164 KB Output is correct
128 Correct 78 ms 3160 KB Output is correct
129 Correct 7 ms 3160 KB Output is correct
130 Correct 10 ms 3276 KB Output is correct
131 Correct 210 ms 3160 KB Output is correct
132 Correct 91 ms 3160 KB Output is correct
133 Correct 256 ms 3256 KB Output is correct
134 Correct 241 ms 3160 KB Output is correct
135 Correct 217 ms 3252 KB Output is correct
136 Correct 190 ms 3164 KB Output is correct
137 Correct 3 ms 3160 KB Output is correct
138 Correct 4 ms 3160 KB Output is correct
139 Correct 3 ms 3164 KB Output is correct
140 Correct 10 ms 3280 KB Output is correct
141 Correct 78 ms 3164 KB Output is correct
142 Correct 79 ms 3164 KB Output is correct
143 Correct 40 ms 3164 KB Output is correct
144 Correct 105 ms 3160 KB Output is correct
145 Correct 100 ms 3164 KB Output is correct
146 Correct 7 ms 3164 KB Output is correct
147 Correct 11 ms 3420 KB Output is correct
148 Correct 201 ms 3164 KB Output is correct
149 Correct 197 ms 3164 KB Output is correct
150 Correct 78 ms 3164 KB Output is correct
151 Correct 219 ms 3576 KB Output is correct
152 Correct 214 ms 3256 KB Output is correct
153 Correct 7 ms 3164 KB Output is correct
154 Correct 10 ms 3160 KB Output is correct
155 Correct 55 ms 3164 KB Output is correct
156 Correct 18 ms 3160 KB Output is correct
157 Correct 59 ms 3160 KB Output is correct
158 Correct 85 ms 3252 KB Output is correct
159 Correct 48 ms 3160 KB Output is correct
160 Correct 9 ms 3160 KB Output is correct
161 Correct 9 ms 3276 KB Output is correct
162 Correct 26 ms 3160 KB Output is correct
163 Correct 40 ms 3248 KB Output is correct
164 Correct 92 ms 3252 KB Output is correct
165 Correct 45 ms 3164 KB Output is correct
166 Correct 94 ms 3164 KB Output is correct
167 Correct 112 ms 3160 KB Output is correct
168 Correct 98 ms 3248 KB Output is correct
169 Correct 77 ms 3160 KB Output is correct
170 Correct 60 ms 3160 KB Output is correct
171 Correct 22 ms 3160 KB Output is correct
172 Correct 64 ms 3256 KB Output is correct
173 Correct 50 ms 3160 KB Output is correct
174 Correct 52 ms 3248 KB Output is correct
175 Correct 90 ms 3160 KB Output is correct
176 Correct 120 ms 3256 KB Output is correct
177 Correct 88 ms 3252 KB Output is correct
178 Correct 102 ms 3160 KB Output is correct
179 Correct 217 ms 3164 KB Output is correct
180 Correct 93 ms 3160 KB Output is correct
181 Correct 229 ms 3160 KB Output is correct
182 Correct 238 ms 3252 KB Output is correct
183 Correct 213 ms 3160 KB Output is correct
184 Correct 181 ms 3256 KB Output is correct
185 Correct 216 ms 3256 KB Output is correct
186 Correct 237 ms 3412 KB Output is correct
187 Correct 212 ms 3164 KB Output is correct
188 Correct 236 ms 3256 KB Output is correct
189 Correct 10 ms 3272 KB Output is correct
190 Correct 54 ms 3160 KB Output is correct
191 Correct 18 ms 3160 KB Output is correct
192 Correct 76 ms 3164 KB Output is correct
193 Correct 64 ms 3160 KB Output is correct
194 Correct 47 ms 3164 KB Output is correct
195 Correct 9 ms 3164 KB Output is correct
196 Correct 8 ms 3160 KB Output is correct
197 Correct 26 ms 3160 KB Output is correct
198 Correct 42 ms 3260 KB Output is correct
199 Correct 6 ms 3160 KB Output is correct
200 Correct 8 ms 3164 KB Output is correct
201 Correct 92 ms 3164 KB Output is correct
202 Correct 44 ms 3248 KB Output is correct
203 Correct 95 ms 3160 KB Output is correct
204 Correct 112 ms 3252 KB Output is correct
205 Correct 102 ms 3160 KB Output is correct
206 Correct 80 ms 3164 KB Output is correct
207 Correct 7 ms 3160 KB Output is correct
208 Correct 9 ms 3164 KB Output is correct
209 Correct 211 ms 3256 KB Output is correct
210 Correct 105 ms 3248 KB Output is correct
211 Correct 265 ms 3512 KB Output is correct
212 Correct 242 ms 3160 KB Output is correct
213 Correct 243 ms 3160 KB Output is correct
214 Correct 184 ms 3412 KB Output is correct
215 Correct 842 ms 3264 KB Output is correct
216 Correct 367 ms 3164 KB Output is correct
217 Correct 836 ms 3280 KB Output is correct
218 Correct 922 ms 3160 KB Output is correct
219 Correct 11 ms 3164 KB Output is correct
220 Correct 11 ms 3164 KB Output is correct
221 Correct 744 ms 3260 KB Output is correct
222 Correct 10 ms 3164 KB Output is correct
223 Correct 75 ms 3244 KB Output is correct
224 Correct 18 ms 3160 KB Output is correct
225 Correct 58 ms 3164 KB Output is correct
226 Correct 64 ms 3164 KB Output is correct
227 Correct 49 ms 3164 KB Output is correct
228 Correct 9 ms 3276 KB Output is correct
229 Correct 8 ms 3164 KB Output is correct
230 Correct 26 ms 3272 KB Output is correct
231 Correct 43 ms 3160 KB Output is correct
232 Correct 6 ms 3276 KB Output is correct
233 Correct 12 ms 3160 KB Output is correct
234 Correct 97 ms 3248 KB Output is correct
235 Correct 44 ms 3160 KB Output is correct
236 Correct 93 ms 3164 KB Output is correct
237 Correct 122 ms 3248 KB Output is correct
238 Correct 96 ms 3248 KB Output is correct
239 Correct 80 ms 3160 KB Output is correct
240 Correct 9 ms 3420 KB Output is correct
241 Correct 10 ms 3284 KB Output is correct
242 Correct 223 ms 3416 KB Output is correct
243 Correct 96 ms 3164 KB Output is correct
244 Correct 238 ms 3408 KB Output is correct
245 Correct 239 ms 3160 KB Output is correct
246 Correct 212 ms 3164 KB Output is correct
247 Correct 187 ms 3256 KB Output is correct
248 Correct 3 ms 3160 KB Output is correct
249 Correct 3 ms 3164 KB Output is correct
250 Correct 3 ms 3164 KB Output is correct
251 Correct 74 ms 3256 KB Output is correct
252 Correct 82 ms 3164 KB Output is correct
253 Correct 41 ms 3164 KB Output is correct
254 Correct 87 ms 3160 KB Output is correct
255 Correct 103 ms 3248 KB Output is correct
256 Correct 200 ms 3160 KB Output is correct
257 Correct 203 ms 3252 KB Output is correct
258 Correct 78 ms 3316 KB Output is correct
259 Correct 218 ms 3252 KB Output is correct
260 Correct 259 ms 3160 KB Output is correct
261 Correct 59 ms 3244 KB Output is correct
262 Correct 27 ms 3164 KB Output is correct
263 Correct 63 ms 3244 KB Output is correct
264 Correct 51 ms 3248 KB Output is correct
265 Correct 52 ms 3164 KB Output is correct
266 Correct 93 ms 3252 KB Output is correct
267 Correct 110 ms 3160 KB Output is correct
268 Correct 88 ms 3252 KB Output is correct
269 Correct 100 ms 3252 KB Output is correct
270 Correct 218 ms 3256 KB Output is correct
271 Correct 265 ms 3276 KB Output is correct
272 Correct 220 ms 3164 KB Output is correct
273 Correct 219 ms 3252 KB Output is correct
274 Correct 897 ms 3264 KB Output is correct
275 Correct 365 ms 3164 KB Output is correct
276 Correct 852 ms 3260 KB Output is correct
277 Correct 922 ms 3268 KB Output is correct
278 Correct 12 ms 3164 KB Output is correct
279 Correct 11 ms 3164 KB Output is correct
280 Correct 726 ms 3260 KB Output is correct
281 Correct 817 ms 3160 KB Output is correct
282 Correct 913 ms 3164 KB Output is correct
283 Correct 838 ms 3164 KB Output is correct