답안 #860610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860610 2023-10-13T14:21:07 Z E869120 Uplifting Excursion (BOI22_vault) C++14
70 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

vector<long long> SolveDP(long long N, long long LIM, vector<long long> List, vector<long long> Init) {
    vector<long long> dp(LIM + 1, -(1LL << 60));
    if (Init.size() == 0) dp[0] = 0;
    else {
        for (int i = 0; i < (int)Init.size(); i++) dp[i] = Init[i];
    }

    // DP Start
    for (int i = 0; i < N; i++) {
        vector<long long> ndp(LIM + 1, -(1LL << 60));
        long long kazu = i + 1;
        for (int j = 0; j < kazu; j++) {
            vector<pair<long long, long long>> maxi;
            int cur = 0;
            for (int k = j; k <= LIM; k += kazu) {
                long long val = dp[k] - (k / kazu);
                while (maxi.size() >= cur + 1) {
                    if (maxi[maxi.size() - 1].second <= val) maxi.pop_back();
                    else break;
                }
                maxi.push_back(make_pair(1LL * k, val));
                if (maxi[cur].second >= -(1LL << 59)) ndp[k] = maxi[cur].second + (k / kazu);
                while (cur < (int)maxi.size() && maxi[cur].first <= k - 1LL * kazu * List[i]) cur += 1;
            }
        }
        dp = ndp;
    }

    // Return
    return dp;
}

void Solve_Subtask2(long long M, long long L, vector<long long> A) {
    // Step 1. Calculate
    vector<long long> A1;
    vector<long long> A2;
    for (int i = M - 1; i >= 0; i--) A1.push_back(A[i]);
    for (int i = M + 1; i <= 2 * M; i++) A2.push_back(A[i]);
    vector<long long> DP1 = SolveDP(M, 700000, A1, vector<long long>{});
    vector<long long> DP2 = SolveDP(M, 700000, A2, vector<long long>{});

    // Step 2. Output
    long long Answer = -(1LL << 60);
    for (long long i = 0; i <= 700000LL - abs(L); i++) {
        long long idx1 = i;
        long long idx2 = i + abs(L); if (L < 0) swap(idx1, idx2);
        Answer = max(Answer, DP1[idx1] + DP2[idx2]);
    }
    if (Answer < 0LL) cout << "impossible" << endl;
    else cout << Answer + A[M] << endl;
}

void Solve_Subtask3(long long M, long long L, vector<long long> A) {
    long long Baseln = M * M * M;
    long long Border = M * M;
    vector<long long> L1(M + 1, 0);
    vector<long long> L2(M + 1, 0);
    vector<long long> L3(M, 0);
    vector<long long> L4(M, 0);
    vector<long long> M1(M + 1, 0);
    vector<long long> M2(M + 1, 0);
    vector<pair<long long, long long>> Cand1; Cand1.push_back(make_pair(0, 0));
    vector<pair<long long, long long>> Cand2; Cand2.push_back(make_pair(0, 0));

    // Step 1. Set Up
    for (int i = 0; i <= M - 1; i++) {
        int idx = M - i;
        long long Threshold = Border / idx;
        L1[idx - 0] = A[i] - min(A[i], Threshold);
        L3[idx - 1] = min(A[i], Threshold);
    }
    for (int i = M + 1; i <= 2 * M; i++) {
        int idx = i - M;
        long long Threshold = Border / idx;
        L2[idx - 0] = A[i] - min(A[i], Threshold);
        L4[idx - 1] = min(A[i], Threshold);
    }

    // Step 2. Base DP
    vector<long long> dp1 = SolveDP(M, Baseln, L3, vector<long long>{});
    vector<long long> dp2 = vector<long long>(Baseln + 1, -(1LL << 60));
    for (int i = 0; i <= Baseln; i++) dp2[Baseln - i] = dp1[i];
    vector<long long> dp3 = SolveDP(M, Baseln * 2, L4, dp2);

    // Step 3. Get Theoritical Value
    long long a1 = 0;
    long long a2 = 0;
    for (int i = 1; i <= M; i++) a1 += 1LL * i * L1[i];
    for (int i = 1; i <= M; i++) a2 += 1LL * i * L2[i];
    if (a2 - a1 > L) a2 = a1 + L;
    else a1 = a2 - L;
    if (a1 + Baseln < 0 || a2 + Baseln < 0) {
        cout << "impossible" << endl;
        return;
    }

    // Step 4. Get Candiates for L1
    long long rem1 = a1 + Baseln;
    long long cnt1 = 0;
    for (int i = 1; i <= M; i++) {
        M1[i] = min(L1[i], rem1 / i);
        rem1 -= 1LL * i * M1[i];
        cnt1 += M1[i];
    }
    for (int i = M; i >= 1; i--) {
        for (long long j = 0; j < M1[i]; j++) {
            Cand1.push_back(make_pair((a1 + Baseln) - rem1, cnt1));
            rem1 += 1LL * i;
            cnt1 -= 1LL;
            if (rem1 > 2LL * Baseln) break;
        }
        if (rem1 > 2LL * Baseln) break;
    }

    // Step 5. Get Candidates for L2
    long long rem2 = a2 + Baseln;
    long long cnt2 = 0;
    for (int i = 1; i <= M; i++) {
        M2[i] = min(L2[i], rem2 / i);
        rem2 -= 1LL * i * M2[i];
        cnt2 += M2[i];
    }
    for (int i = M; i >= 1; i--) {
        for (long long j = 0; j < M2[i]; j++) {
            Cand2.push_back(make_pair((a2 + Baseln) - rem2, cnt2));
            rem2 += 1LL * i;
            cnt2 -= 1LL;
            if (rem2 > 2LL * Baseln) break;
        }
        if (rem2 > 2LL * Baseln) break;
    }
    // cout << "L1 = "; for (int i = 1; i <= M; i++) cout << L1[i] << " "; cout << endl;
    // cout << "L2 = "; for (int i = 1; i <= M; i++) cout << L2[i] << " "; cout << endl;
    // cout << "Cand1 = "; for (int i = 0; i < Cand1.size(); i++) cout << "(" << Cand1[i].first << "," << Cand1[i].second << ") "; cout << endl;
    // cout << "Cand2 = "; for (int i = 0; i < Cand2.size(); i++) cout << "(" << Cand2[i].first << "," << Cand2[i].second << ") "; cout << endl;

    // Step 6. Brute Force
    long long Answer = -(1LL << 60);
    for (pair<long long, long long> v1 : Cand1) {
        for (pair<long long, long long> v2 : Cand2) {
            long long diff = L - (v2.first - v1.first);
            if (diff < -Baseln || diff > Baseln) continue;
            if (dp3[diff + Baseln] == -(1LL << 60)) continue;
            Answer = max(Answer, v1.second + v2.second + dp3[diff + Baseln]);
        }
    }

    // Step 7. Output
    if (Answer == -(1LL << 60)) cout << "impossible" << endl;
    else cout << Answer + A[M] << endl;
}

int main() {
    // Input
    long long M, L;
    cin >> M >> L;
    vector<long long> A(2 * M + 1, 0);
    for (int i = 0; i <= 2 * M; i++) cin >> A[i];

    // Judge if Subtask 2
    bool Subtask2 = true;
    if (M > 100) Subtask2 = false;
    for (int i = 0; i <= 2 * M; i++) {
        if (A[i] > 100) Subtask2 = false;
    }

    // Execution
    if (Subtask2 == true) Solve_Subtask2(M, L, A);
    else Solve_Subtask3(M, L, A);
    return 0;
}

Compilation message

vault.cpp: In function 'std::vector<long long int> SolveDP(long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
vault.cpp:25:36: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |                 while (maxi.size() >= cur + 1) {
      |                        ~~~~~~~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 44240 KB Output is correct
2 Correct 72 ms 44884 KB Output is correct
3 Correct 33 ms 46228 KB Output is correct
4 Correct 190 ms 44784 KB Output is correct
5 Correct 805 ms 46116 KB Output is correct
6 Correct 805 ms 45524 KB Output is correct
7 Correct 856 ms 44896 KB Output is correct
8 Correct 799 ms 45112 KB Output is correct
9 Correct 798 ms 45740 KB Output is correct
10 Correct 893 ms 45752 KB Output is correct
11 Correct 922 ms 44556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 44240 KB Output is correct
2 Correct 72 ms 44884 KB Output is correct
3 Correct 33 ms 46228 KB Output is correct
4 Correct 190 ms 44784 KB Output is correct
5 Correct 805 ms 46116 KB Output is correct
6 Correct 805 ms 45524 KB Output is correct
7 Correct 856 ms 44896 KB Output is correct
8 Correct 799 ms 45112 KB Output is correct
9 Correct 798 ms 45740 KB Output is correct
10 Correct 893 ms 45752 KB Output is correct
11 Correct 922 ms 44556 KB Output is correct
12 Correct 52 ms 45884 KB Output is correct
13 Correct 72 ms 44616 KB Output is correct
14 Correct 35 ms 47536 KB Output is correct
15 Correct 189 ms 44232 KB Output is correct
16 Correct 801 ms 45284 KB Output is correct
17 Correct 830 ms 47732 KB Output is correct
18 Correct 870 ms 44792 KB Output is correct
19 Correct 827 ms 44940 KB Output is correct
20 Correct 806 ms 45132 KB Output is correct
21 Correct 875 ms 44096 KB Output is correct
22 Correct 885 ms 44816 KB Output is correct
23 Correct 1644 ms 46276 KB Output is correct
24 Correct 1587 ms 45180 KB Output is correct
25 Correct 1725 ms 44868 KB Output is correct
26 Correct 1606 ms 45320 KB Output is correct
27 Correct 1601 ms 45056 KB Output is correct
28 Correct 1749 ms 44412 KB Output is correct
29 Correct 1760 ms 47668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 44696 KB Output is correct
2 Correct 30 ms 3412 KB Output is correct
3 Correct 30 ms 3412 KB Output is correct
4 Correct 29 ms 3416 KB Output is correct
5 Correct 29 ms 3416 KB Output is correct
6 Correct 30 ms 3388 KB Output is correct
7 Correct 31 ms 3668 KB Output is correct
8 Correct 31 ms 3392 KB Output is correct
9 Correct 33 ms 3416 KB Output is correct
10 Correct 31 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 44696 KB Output is correct
2 Correct 30 ms 3412 KB Output is correct
3 Correct 30 ms 3412 KB Output is correct
4 Correct 29 ms 3416 KB Output is correct
5 Correct 29 ms 3416 KB Output is correct
6 Correct 30 ms 3388 KB Output is correct
7 Correct 31 ms 3668 KB Output is correct
8 Correct 31 ms 3392 KB Output is correct
9 Correct 33 ms 3416 KB Output is correct
10 Correct 31 ms 3412 KB Output is correct
11 Correct 52 ms 44920 KB Output is correct
12 Correct 72 ms 44780 KB Output is correct
13 Correct 32 ms 44244 KB Output is correct
14 Correct 197 ms 46200 KB Output is correct
15 Correct 29 ms 3416 KB Output is correct
16 Correct 30 ms 3412 KB Output is correct
17 Correct 29 ms 3416 KB Output is correct
18 Correct 35 ms 3412 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 31 ms 3412 KB Output is correct
21 Correct 31 ms 3416 KB Output is correct
22 Correct 32 ms 3416 KB Output is correct
23 Correct 30 ms 3412 KB Output is correct
24 Correct 33 ms 3416 KB Output is correct
25 Correct 31 ms 3416 KB Output is correct
26 Correct 40 ms 3416 KB Output is correct
27 Correct 33 ms 3416 KB Output is correct
28 Correct 68 ms 3416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 44696 KB Output is correct
2 Correct 30 ms 3412 KB Output is correct
3 Correct 30 ms 3412 KB Output is correct
4 Correct 29 ms 3416 KB Output is correct
5 Correct 29 ms 3416 KB Output is correct
6 Correct 30 ms 3388 KB Output is correct
7 Correct 31 ms 3668 KB Output is correct
8 Correct 31 ms 3392 KB Output is correct
9 Correct 33 ms 3416 KB Output is correct
10 Correct 31 ms 3412 KB Output is correct
11 Correct 194 ms 44712 KB Output is correct
12 Correct 29 ms 3412 KB Output is correct
13 Correct 31 ms 3416 KB Output is correct
14 Correct 30 ms 3416 KB Output is correct
15 Correct 29 ms 3416 KB Output is correct
16 Correct 30 ms 3412 KB Output is correct
17 Correct 31 ms 3412 KB Output is correct
18 Correct 32 ms 3412 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 30 ms 3416 KB Output is correct
21 Correct 897 ms 46068 KB Output is correct
22 Correct 917 ms 44400 KB Output is correct
23 Correct 221 ms 13892 KB Output is correct
24 Correct 231 ms 15168 KB Output is correct
25 Correct 223 ms 14656 KB Output is correct
26 Correct 221 ms 13864 KB Output is correct
27 Correct 228 ms 15424 KB Output is correct
28 Correct 225 ms 14400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 44240 KB Output is correct
2 Correct 72 ms 44884 KB Output is correct
3 Correct 33 ms 46228 KB Output is correct
4 Correct 190 ms 44784 KB Output is correct
5 Correct 805 ms 46116 KB Output is correct
6 Correct 805 ms 45524 KB Output is correct
7 Correct 856 ms 44896 KB Output is correct
8 Correct 799 ms 45112 KB Output is correct
9 Correct 798 ms 45740 KB Output is correct
10 Correct 893 ms 45752 KB Output is correct
11 Correct 922 ms 44556 KB Output is correct
12 Correct 190 ms 44696 KB Output is correct
13 Correct 30 ms 3412 KB Output is correct
14 Correct 30 ms 3412 KB Output is correct
15 Correct 29 ms 3416 KB Output is correct
16 Correct 29 ms 3416 KB Output is correct
17 Correct 30 ms 3388 KB Output is correct
18 Correct 31 ms 3668 KB Output is correct
19 Correct 31 ms 3392 KB Output is correct
20 Correct 33 ms 3416 KB Output is correct
21 Correct 31 ms 3412 KB Output is correct
22 Correct 52 ms 44920 KB Output is correct
23 Correct 72 ms 44780 KB Output is correct
24 Correct 32 ms 44244 KB Output is correct
25 Correct 197 ms 46200 KB Output is correct
26 Correct 29 ms 3416 KB Output is correct
27 Correct 30 ms 3412 KB Output is correct
28 Correct 29 ms 3416 KB Output is correct
29 Correct 35 ms 3412 KB Output is correct
30 Correct 30 ms 3416 KB Output is correct
31 Correct 31 ms 3412 KB Output is correct
32 Correct 31 ms 3416 KB Output is correct
33 Correct 32 ms 3416 KB Output is correct
34 Correct 30 ms 3412 KB Output is correct
35 Correct 33 ms 3416 KB Output is correct
36 Correct 31 ms 3416 KB Output is correct
37 Correct 40 ms 3416 KB Output is correct
38 Correct 33 ms 3416 KB Output is correct
39 Correct 68 ms 3416 KB Output is correct
40 Correct 194 ms 44712 KB Output is correct
41 Correct 29 ms 3412 KB Output is correct
42 Correct 31 ms 3416 KB Output is correct
43 Correct 30 ms 3416 KB Output is correct
44 Correct 29 ms 3416 KB Output is correct
45 Correct 30 ms 3412 KB Output is correct
46 Correct 31 ms 3412 KB Output is correct
47 Correct 32 ms 3412 KB Output is correct
48 Correct 30 ms 3416 KB Output is correct
49 Correct 30 ms 3416 KB Output is correct
50 Correct 897 ms 46068 KB Output is correct
51 Correct 917 ms 44400 KB Output is correct
52 Correct 221 ms 13892 KB Output is correct
53 Correct 231 ms 15168 KB Output is correct
54 Correct 223 ms 14656 KB Output is correct
55 Correct 221 ms 13864 KB Output is correct
56 Correct 228 ms 15424 KB Output is correct
57 Correct 225 ms 14400 KB Output is correct
58 Correct 52 ms 44800 KB Output is correct
59 Correct 75 ms 44548 KB Output is correct
60 Correct 34 ms 45600 KB Output is correct
61 Correct 193 ms 44432 KB Output is correct
62 Correct 819 ms 45312 KB Output is correct
63 Correct 803 ms 44820 KB Output is correct
64 Correct 862 ms 45192 KB Output is correct
65 Correct 805 ms 45928 KB Output is correct
66 Correct 812 ms 44876 KB Output is correct
67 Correct 882 ms 46176 KB Output is correct
68 Correct 893 ms 44800 KB Output is correct
69 Correct 29 ms 3416 KB Output is correct
70 Correct 30 ms 3416 KB Output is correct
71 Correct 29 ms 3416 KB Output is correct
72 Correct 29 ms 3416 KB Output is correct
73 Correct 30 ms 3416 KB Output is correct
74 Correct 31 ms 3416 KB Output is correct
75 Correct 31 ms 3308 KB Output is correct
76 Correct 30 ms 3416 KB Output is correct
77 Correct 30 ms 3400 KB Output is correct
78 Correct 31 ms 3416 KB Output is correct
79 Correct 32 ms 3416 KB Output is correct
80 Correct 40 ms 3416 KB Output is correct
81 Correct 35 ms 3412 KB Output is correct
82 Correct 71 ms 3412 KB Output is correct
83 Correct 221 ms 14632 KB Output is correct
84 Correct 229 ms 13636 KB Output is correct
85 Correct 225 ms 14380 KB Output is correct
86 Correct 230 ms 14396 KB Output is correct
87 Correct 223 ms 15424 KB Output is correct
88 Correct 223 ms 15164 KB Output is correct
89 Correct 222 ms 15148 KB Output is correct
90 Correct 243 ms 15380 KB Output is correct
91 Correct 252 ms 13380 KB Output is correct
92 Correct 715 ms 13376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 44696 KB Output is correct
2 Correct 30 ms 3412 KB Output is correct
3 Correct 30 ms 3412 KB Output is correct
4 Correct 29 ms 3416 KB Output is correct
5 Correct 29 ms 3416 KB Output is correct
6 Correct 30 ms 3388 KB Output is correct
7 Correct 31 ms 3668 KB Output is correct
8 Correct 31 ms 3392 KB Output is correct
9 Correct 33 ms 3416 KB Output is correct
10 Correct 31 ms 3412 KB Output is correct
11 Correct 194 ms 44712 KB Output is correct
12 Correct 29 ms 3412 KB Output is correct
13 Correct 31 ms 3416 KB Output is correct
14 Correct 30 ms 3416 KB Output is correct
15 Correct 29 ms 3416 KB Output is correct
16 Correct 30 ms 3412 KB Output is correct
17 Correct 31 ms 3412 KB Output is correct
18 Correct 32 ms 3412 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 30 ms 3416 KB Output is correct
21 Correct 897 ms 46068 KB Output is correct
22 Correct 917 ms 44400 KB Output is correct
23 Correct 221 ms 13892 KB Output is correct
24 Correct 231 ms 15168 KB Output is correct
25 Correct 223 ms 14656 KB Output is correct
26 Correct 221 ms 13864 KB Output is correct
27 Correct 228 ms 15424 KB Output is correct
28 Correct 225 ms 14400 KB Output is correct
29 Correct 189 ms 45012 KB Output is correct
30 Correct 29 ms 3412 KB Output is correct
31 Correct 31 ms 3388 KB Output is correct
32 Correct 29 ms 3416 KB Output is correct
33 Correct 29 ms 3416 KB Output is correct
34 Correct 30 ms 3360 KB Output is correct
35 Correct 31 ms 3416 KB Output is correct
36 Correct 31 ms 3416 KB Output is correct
37 Correct 30 ms 3412 KB Output is correct
38 Correct 29 ms 3416 KB Output is correct
39 Correct 883 ms 46212 KB Output is correct
40 Correct 874 ms 45284 KB Output is correct
41 Correct 224 ms 14144 KB Output is correct
42 Correct 227 ms 14652 KB Output is correct
43 Correct 221 ms 13368 KB Output is correct
44 Correct 222 ms 14400 KB Output is correct
45 Correct 226 ms 15400 KB Output is correct
46 Correct 239 ms 14628 KB Output is correct
47 Correct 1734 ms 47640 KB Output is correct
48 Correct 1729 ms 47696 KB Output is correct
49 Correct 3803 ms 105604 KB Output is correct
50 Correct 3859 ms 104692 KB Output is correct
51 Correct 3833 ms 104932 KB Output is correct
52 Correct 3871 ms 105856 KB Output is correct
53 Correct 3924 ms 104316 KB Output is correct
54 Correct 3968 ms 106368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 44240 KB Output is correct
2 Correct 72 ms 44884 KB Output is correct
3 Correct 33 ms 46228 KB Output is correct
4 Correct 190 ms 44784 KB Output is correct
5 Correct 805 ms 46116 KB Output is correct
6 Correct 805 ms 45524 KB Output is correct
7 Correct 856 ms 44896 KB Output is correct
8 Correct 799 ms 45112 KB Output is correct
9 Correct 798 ms 45740 KB Output is correct
10 Correct 893 ms 45752 KB Output is correct
11 Correct 922 ms 44556 KB Output is correct
12 Correct 52 ms 45884 KB Output is correct
13 Correct 72 ms 44616 KB Output is correct
14 Correct 35 ms 47536 KB Output is correct
15 Correct 189 ms 44232 KB Output is correct
16 Correct 801 ms 45284 KB Output is correct
17 Correct 830 ms 47732 KB Output is correct
18 Correct 870 ms 44792 KB Output is correct
19 Correct 827 ms 44940 KB Output is correct
20 Correct 806 ms 45132 KB Output is correct
21 Correct 875 ms 44096 KB Output is correct
22 Correct 885 ms 44816 KB Output is correct
23 Correct 1644 ms 46276 KB Output is correct
24 Correct 1587 ms 45180 KB Output is correct
25 Correct 1725 ms 44868 KB Output is correct
26 Correct 1606 ms 45320 KB Output is correct
27 Correct 1601 ms 45056 KB Output is correct
28 Correct 1749 ms 44412 KB Output is correct
29 Correct 1760 ms 47668 KB Output is correct
30 Correct 190 ms 44696 KB Output is correct
31 Correct 30 ms 3412 KB Output is correct
32 Correct 30 ms 3412 KB Output is correct
33 Correct 29 ms 3416 KB Output is correct
34 Correct 29 ms 3416 KB Output is correct
35 Correct 30 ms 3388 KB Output is correct
36 Correct 31 ms 3668 KB Output is correct
37 Correct 31 ms 3392 KB Output is correct
38 Correct 33 ms 3416 KB Output is correct
39 Correct 31 ms 3412 KB Output is correct
40 Correct 52 ms 44920 KB Output is correct
41 Correct 72 ms 44780 KB Output is correct
42 Correct 32 ms 44244 KB Output is correct
43 Correct 197 ms 46200 KB Output is correct
44 Correct 29 ms 3416 KB Output is correct
45 Correct 30 ms 3412 KB Output is correct
46 Correct 29 ms 3416 KB Output is correct
47 Correct 35 ms 3412 KB Output is correct
48 Correct 30 ms 3416 KB Output is correct
49 Correct 31 ms 3412 KB Output is correct
50 Correct 31 ms 3416 KB Output is correct
51 Correct 32 ms 3416 KB Output is correct
52 Correct 30 ms 3412 KB Output is correct
53 Correct 33 ms 3416 KB Output is correct
54 Correct 31 ms 3416 KB Output is correct
55 Correct 40 ms 3416 KB Output is correct
56 Correct 33 ms 3416 KB Output is correct
57 Correct 68 ms 3416 KB Output is correct
58 Correct 194 ms 44712 KB Output is correct
59 Correct 29 ms 3412 KB Output is correct
60 Correct 31 ms 3416 KB Output is correct
61 Correct 30 ms 3416 KB Output is correct
62 Correct 29 ms 3416 KB Output is correct
63 Correct 30 ms 3412 KB Output is correct
64 Correct 31 ms 3412 KB Output is correct
65 Correct 32 ms 3412 KB Output is correct
66 Correct 30 ms 3416 KB Output is correct
67 Correct 30 ms 3416 KB Output is correct
68 Correct 897 ms 46068 KB Output is correct
69 Correct 917 ms 44400 KB Output is correct
70 Correct 221 ms 13892 KB Output is correct
71 Correct 231 ms 15168 KB Output is correct
72 Correct 223 ms 14656 KB Output is correct
73 Correct 221 ms 13864 KB Output is correct
74 Correct 228 ms 15424 KB Output is correct
75 Correct 225 ms 14400 KB Output is correct
76 Correct 52 ms 44800 KB Output is correct
77 Correct 75 ms 44548 KB Output is correct
78 Correct 34 ms 45600 KB Output is correct
79 Correct 193 ms 44432 KB Output is correct
80 Correct 819 ms 45312 KB Output is correct
81 Correct 803 ms 44820 KB Output is correct
82 Correct 862 ms 45192 KB Output is correct
83 Correct 805 ms 45928 KB Output is correct
84 Correct 812 ms 44876 KB Output is correct
85 Correct 882 ms 46176 KB Output is correct
86 Correct 893 ms 44800 KB Output is correct
87 Correct 29 ms 3416 KB Output is correct
88 Correct 30 ms 3416 KB Output is correct
89 Correct 29 ms 3416 KB Output is correct
90 Correct 29 ms 3416 KB Output is correct
91 Correct 30 ms 3416 KB Output is correct
92 Correct 31 ms 3416 KB Output is correct
93 Correct 31 ms 3308 KB Output is correct
94 Correct 30 ms 3416 KB Output is correct
95 Correct 30 ms 3400 KB Output is correct
96 Correct 31 ms 3416 KB Output is correct
97 Correct 32 ms 3416 KB Output is correct
98 Correct 40 ms 3416 KB Output is correct
99 Correct 35 ms 3412 KB Output is correct
100 Correct 71 ms 3412 KB Output is correct
101 Correct 221 ms 14632 KB Output is correct
102 Correct 229 ms 13636 KB Output is correct
103 Correct 225 ms 14380 KB Output is correct
104 Correct 230 ms 14396 KB Output is correct
105 Correct 223 ms 15424 KB Output is correct
106 Correct 223 ms 15164 KB Output is correct
107 Correct 222 ms 15148 KB Output is correct
108 Correct 243 ms 15380 KB Output is correct
109 Correct 252 ms 13380 KB Output is correct
110 Correct 715 ms 13376 KB Output is correct
111 Correct 189 ms 45012 KB Output is correct
112 Correct 29 ms 3412 KB Output is correct
113 Correct 31 ms 3388 KB Output is correct
114 Correct 29 ms 3416 KB Output is correct
115 Correct 29 ms 3416 KB Output is correct
116 Correct 30 ms 3360 KB Output is correct
117 Correct 31 ms 3416 KB Output is correct
118 Correct 31 ms 3416 KB Output is correct
119 Correct 30 ms 3412 KB Output is correct
120 Correct 29 ms 3416 KB Output is correct
121 Correct 883 ms 46212 KB Output is correct
122 Correct 874 ms 45284 KB Output is correct
123 Correct 224 ms 14144 KB Output is correct
124 Correct 227 ms 14652 KB Output is correct
125 Correct 221 ms 13368 KB Output is correct
126 Correct 222 ms 14400 KB Output is correct
127 Correct 226 ms 15400 KB Output is correct
128 Correct 239 ms 14628 KB Output is correct
129 Correct 1734 ms 47640 KB Output is correct
130 Correct 1729 ms 47696 KB Output is correct
131 Correct 3803 ms 105604 KB Output is correct
132 Correct 3859 ms 104692 KB Output is correct
133 Correct 3833 ms 104932 KB Output is correct
134 Correct 3871 ms 105856 KB Output is correct
135 Correct 3924 ms 104316 KB Output is correct
136 Correct 3968 ms 106368 KB Output is correct
137 Correct 51 ms 45592 KB Output is correct
138 Correct 72 ms 45320 KB Output is correct
139 Correct 34 ms 45684 KB Output is correct
140 Correct 190 ms 45872 KB Output is correct
141 Correct 804 ms 44280 KB Output is correct
142 Correct 806 ms 44004 KB Output is correct
143 Correct 885 ms 45812 KB Output is correct
144 Correct 826 ms 45720 KB Output is correct
145 Correct 820 ms 45292 KB Output is correct
146 Correct 892 ms 44912 KB Output is correct
147 Correct 908 ms 45360 KB Output is correct
148 Correct 1585 ms 44208 KB Output is correct
149 Correct 1624 ms 44616 KB Output is correct
150 Correct 1720 ms 44352 KB Output is correct
151 Correct 1603 ms 44556 KB Output is correct
152 Correct 1604 ms 47692 KB Output is correct
153 Correct 1757 ms 44584 KB Output is correct
154 Correct 1732 ms 45864 KB Output is correct
155 Correct 29 ms 3412 KB Output is correct
156 Correct 30 ms 3412 KB Output is correct
157 Correct 29 ms 3416 KB Output is correct
158 Correct 29 ms 3252 KB Output is correct
159 Correct 30 ms 3416 KB Output is correct
160 Correct 31 ms 3416 KB Output is correct
161 Correct 31 ms 3668 KB Output is correct
162 Correct 30 ms 3400 KB Output is correct
163 Correct 30 ms 3392 KB Output is correct
164 Correct 219 ms 15160 KB Output is correct
165 Correct 228 ms 14148 KB Output is correct
166 Correct 221 ms 13360 KB Output is correct
167 Correct 223 ms 13892 KB Output is correct
168 Correct 223 ms 13376 KB Output is correct
169 Correct 228 ms 15056 KB Output is correct
170 Correct 30 ms 3416 KB Output is correct
171 Correct 31 ms 3412 KB Output is correct
172 Correct 40 ms 3416 KB Output is correct
173 Correct 31 ms 3416 KB Output is correct
174 Correct 72 ms 3416 KB Output is correct
175 Correct 227 ms 13376 KB Output is correct
176 Correct 241 ms 15132 KB Output is correct
177 Correct 256 ms 14400 KB Output is correct
178 Correct 714 ms 14908 KB Output is correct
179 Correct 3873 ms 104584 KB Output is correct
180 Correct 3919 ms 105608 KB Output is correct
181 Correct 3804 ms 104484 KB Output is correct
182 Correct 3872 ms 105224 KB Output is correct
183 Correct 3972 ms 104744 KB Output is correct
184 Correct 3972 ms 105348 KB Output is correct
185 Correct 4266 ms 104564 KB Output is correct
186 Execution timed out 5044 ms 105092 KB Time limit exceeded
187 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 44696 KB Output is correct
2 Correct 30 ms 3412 KB Output is correct
3 Correct 30 ms 3412 KB Output is correct
4 Correct 29 ms 3416 KB Output is correct
5 Correct 29 ms 3416 KB Output is correct
6 Correct 30 ms 3388 KB Output is correct
7 Correct 31 ms 3668 KB Output is correct
8 Correct 31 ms 3392 KB Output is correct
9 Correct 33 ms 3416 KB Output is correct
10 Correct 31 ms 3412 KB Output is correct
11 Correct 194 ms 44712 KB Output is correct
12 Correct 29 ms 3412 KB Output is correct
13 Correct 31 ms 3416 KB Output is correct
14 Correct 30 ms 3416 KB Output is correct
15 Correct 29 ms 3416 KB Output is correct
16 Correct 30 ms 3412 KB Output is correct
17 Correct 31 ms 3412 KB Output is correct
18 Correct 32 ms 3412 KB Output is correct
19 Correct 30 ms 3416 KB Output is correct
20 Correct 30 ms 3416 KB Output is correct
21 Correct 897 ms 46068 KB Output is correct
22 Correct 917 ms 44400 KB Output is correct
23 Correct 221 ms 13892 KB Output is correct
24 Correct 231 ms 15168 KB Output is correct
25 Correct 223 ms 14656 KB Output is correct
26 Correct 221 ms 13864 KB Output is correct
27 Correct 228 ms 15424 KB Output is correct
28 Correct 225 ms 14400 KB Output is correct
29 Correct 189 ms 45012 KB Output is correct
30 Correct 29 ms 3412 KB Output is correct
31 Correct 31 ms 3388 KB Output is correct
32 Correct 29 ms 3416 KB Output is correct
33 Correct 29 ms 3416 KB Output is correct
34 Correct 30 ms 3360 KB Output is correct
35 Correct 31 ms 3416 KB Output is correct
36 Correct 31 ms 3416 KB Output is correct
37 Correct 30 ms 3412 KB Output is correct
38 Correct 29 ms 3416 KB Output is correct
39 Correct 883 ms 46212 KB Output is correct
40 Correct 874 ms 45284 KB Output is correct
41 Correct 224 ms 14144 KB Output is correct
42 Correct 227 ms 14652 KB Output is correct
43 Correct 221 ms 13368 KB Output is correct
44 Correct 222 ms 14400 KB Output is correct
45 Correct 226 ms 15400 KB Output is correct
46 Correct 239 ms 14628 KB Output is correct
47 Correct 1734 ms 47640 KB Output is correct
48 Correct 1729 ms 47696 KB Output is correct
49 Correct 3803 ms 105604 KB Output is correct
50 Correct 3859 ms 104692 KB Output is correct
51 Correct 3833 ms 104932 KB Output is correct
52 Correct 3871 ms 105856 KB Output is correct
53 Correct 3924 ms 104316 KB Output is correct
54 Correct 3968 ms 106368 KB Output is correct
55 Correct 203 ms 44644 KB Output is correct
56 Correct 31 ms 3412 KB Output is correct
57 Correct 31 ms 3412 KB Output is correct
58 Correct 30 ms 3388 KB Output is correct
59 Correct 30 ms 3412 KB Output is correct
60 Correct 30 ms 3416 KB Output is correct
61 Correct 40 ms 3412 KB Output is correct
62 Correct 32 ms 3412 KB Output is correct
63 Correct 30 ms 3412 KB Output is correct
64 Correct 38 ms 3412 KB Output is correct
65 Correct 898 ms 44876 KB Output is correct
66 Correct 1006 ms 44372 KB Output is correct
67 Correct 229 ms 14888 KB Output is correct
68 Correct 235 ms 14136 KB Output is correct
69 Correct 237 ms 14148 KB Output is correct
70 Correct 234 ms 13884 KB Output is correct
71 Correct 229 ms 13380 KB Output is correct
72 Correct 234 ms 14888 KB Output is correct
73 Correct 1889 ms 45216 KB Output is correct
74 Correct 1814 ms 45264 KB Output is correct
75 Correct 3951 ms 104576 KB Output is correct
76 Correct 4099 ms 105600 KB Output is correct
77 Correct 3973 ms 105092 KB Output is correct
78 Correct 4175 ms 106112 KB Output is correct
79 Correct 4043 ms 104832 KB Output is correct
80 Correct 3936 ms 105000 KB Output is correct
81 Runtime error 146 ms 524288 KB Execution killed with signal 9
82 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 44240 KB Output is correct
2 Correct 72 ms 44884 KB Output is correct
3 Correct 33 ms 46228 KB Output is correct
4 Correct 190 ms 44784 KB Output is correct
5 Correct 805 ms 46116 KB Output is correct
6 Correct 805 ms 45524 KB Output is correct
7 Correct 856 ms 44896 KB Output is correct
8 Correct 799 ms 45112 KB Output is correct
9 Correct 798 ms 45740 KB Output is correct
10 Correct 893 ms 45752 KB Output is correct
11 Correct 922 ms 44556 KB Output is correct
12 Correct 52 ms 45884 KB Output is correct
13 Correct 72 ms 44616 KB Output is correct
14 Correct 35 ms 47536 KB Output is correct
15 Correct 189 ms 44232 KB Output is correct
16 Correct 801 ms 45284 KB Output is correct
17 Correct 830 ms 47732 KB Output is correct
18 Correct 870 ms 44792 KB Output is correct
19 Correct 827 ms 44940 KB Output is correct
20 Correct 806 ms 45132 KB Output is correct
21 Correct 875 ms 44096 KB Output is correct
22 Correct 885 ms 44816 KB Output is correct
23 Correct 1644 ms 46276 KB Output is correct
24 Correct 1587 ms 45180 KB Output is correct
25 Correct 1725 ms 44868 KB Output is correct
26 Correct 1606 ms 45320 KB Output is correct
27 Correct 1601 ms 45056 KB Output is correct
28 Correct 1749 ms 44412 KB Output is correct
29 Correct 1760 ms 47668 KB Output is correct
30 Correct 190 ms 44696 KB Output is correct
31 Correct 30 ms 3412 KB Output is correct
32 Correct 30 ms 3412 KB Output is correct
33 Correct 29 ms 3416 KB Output is correct
34 Correct 29 ms 3416 KB Output is correct
35 Correct 30 ms 3388 KB Output is correct
36 Correct 31 ms 3668 KB Output is correct
37 Correct 31 ms 3392 KB Output is correct
38 Correct 33 ms 3416 KB Output is correct
39 Correct 31 ms 3412 KB Output is correct
40 Correct 52 ms 44920 KB Output is correct
41 Correct 72 ms 44780 KB Output is correct
42 Correct 32 ms 44244 KB Output is correct
43 Correct 197 ms 46200 KB Output is correct
44 Correct 29 ms 3416 KB Output is correct
45 Correct 30 ms 3412 KB Output is correct
46 Correct 29 ms 3416 KB Output is correct
47 Correct 35 ms 3412 KB Output is correct
48 Correct 30 ms 3416 KB Output is correct
49 Correct 31 ms 3412 KB Output is correct
50 Correct 31 ms 3416 KB Output is correct
51 Correct 32 ms 3416 KB Output is correct
52 Correct 30 ms 3412 KB Output is correct
53 Correct 33 ms 3416 KB Output is correct
54 Correct 31 ms 3416 KB Output is correct
55 Correct 40 ms 3416 KB Output is correct
56 Correct 33 ms 3416 KB Output is correct
57 Correct 68 ms 3416 KB Output is correct
58 Correct 194 ms 44712 KB Output is correct
59 Correct 29 ms 3412 KB Output is correct
60 Correct 31 ms 3416 KB Output is correct
61 Correct 30 ms 3416 KB Output is correct
62 Correct 29 ms 3416 KB Output is correct
63 Correct 30 ms 3412 KB Output is correct
64 Correct 31 ms 3412 KB Output is correct
65 Correct 32 ms 3412 KB Output is correct
66 Correct 30 ms 3416 KB Output is correct
67 Correct 30 ms 3416 KB Output is correct
68 Correct 897 ms 46068 KB Output is correct
69 Correct 917 ms 44400 KB Output is correct
70 Correct 221 ms 13892 KB Output is correct
71 Correct 231 ms 15168 KB Output is correct
72 Correct 223 ms 14656 KB Output is correct
73 Correct 221 ms 13864 KB Output is correct
74 Correct 228 ms 15424 KB Output is correct
75 Correct 225 ms 14400 KB Output is correct
76 Correct 52 ms 44800 KB Output is correct
77 Correct 75 ms 44548 KB Output is correct
78 Correct 34 ms 45600 KB Output is correct
79 Correct 193 ms 44432 KB Output is correct
80 Correct 819 ms 45312 KB Output is correct
81 Correct 803 ms 44820 KB Output is correct
82 Correct 862 ms 45192 KB Output is correct
83 Correct 805 ms 45928 KB Output is correct
84 Correct 812 ms 44876 KB Output is correct
85 Correct 882 ms 46176 KB Output is correct
86 Correct 893 ms 44800 KB Output is correct
87 Correct 29 ms 3416 KB Output is correct
88 Correct 30 ms 3416 KB Output is correct
89 Correct 29 ms 3416 KB Output is correct
90 Correct 29 ms 3416 KB Output is correct
91 Correct 30 ms 3416 KB Output is correct
92 Correct 31 ms 3416 KB Output is correct
93 Correct 31 ms 3308 KB Output is correct
94 Correct 30 ms 3416 KB Output is correct
95 Correct 30 ms 3400 KB Output is correct
96 Correct 31 ms 3416 KB Output is correct
97 Correct 32 ms 3416 KB Output is correct
98 Correct 40 ms 3416 KB Output is correct
99 Correct 35 ms 3412 KB Output is correct
100 Correct 71 ms 3412 KB Output is correct
101 Correct 221 ms 14632 KB Output is correct
102 Correct 229 ms 13636 KB Output is correct
103 Correct 225 ms 14380 KB Output is correct
104 Correct 230 ms 14396 KB Output is correct
105 Correct 223 ms 15424 KB Output is correct
106 Correct 223 ms 15164 KB Output is correct
107 Correct 222 ms 15148 KB Output is correct
108 Correct 243 ms 15380 KB Output is correct
109 Correct 252 ms 13380 KB Output is correct
110 Correct 715 ms 13376 KB Output is correct
111 Correct 189 ms 45012 KB Output is correct
112 Correct 29 ms 3412 KB Output is correct
113 Correct 31 ms 3388 KB Output is correct
114 Correct 29 ms 3416 KB Output is correct
115 Correct 29 ms 3416 KB Output is correct
116 Correct 30 ms 3360 KB Output is correct
117 Correct 31 ms 3416 KB Output is correct
118 Correct 31 ms 3416 KB Output is correct
119 Correct 30 ms 3412 KB Output is correct
120 Correct 29 ms 3416 KB Output is correct
121 Correct 883 ms 46212 KB Output is correct
122 Correct 874 ms 45284 KB Output is correct
123 Correct 224 ms 14144 KB Output is correct
124 Correct 227 ms 14652 KB Output is correct
125 Correct 221 ms 13368 KB Output is correct
126 Correct 222 ms 14400 KB Output is correct
127 Correct 226 ms 15400 KB Output is correct
128 Correct 239 ms 14628 KB Output is correct
129 Correct 1734 ms 47640 KB Output is correct
130 Correct 1729 ms 47696 KB Output is correct
131 Correct 3803 ms 105604 KB Output is correct
132 Correct 3859 ms 104692 KB Output is correct
133 Correct 3833 ms 104932 KB Output is correct
134 Correct 3871 ms 105856 KB Output is correct
135 Correct 3924 ms 104316 KB Output is correct
136 Correct 3968 ms 106368 KB Output is correct
137 Correct 51 ms 45592 KB Output is correct
138 Correct 72 ms 45320 KB Output is correct
139 Correct 34 ms 45684 KB Output is correct
140 Correct 190 ms 45872 KB Output is correct
141 Correct 804 ms 44280 KB Output is correct
142 Correct 806 ms 44004 KB Output is correct
143 Correct 885 ms 45812 KB Output is correct
144 Correct 826 ms 45720 KB Output is correct
145 Correct 820 ms 45292 KB Output is correct
146 Correct 892 ms 44912 KB Output is correct
147 Correct 908 ms 45360 KB Output is correct
148 Correct 1585 ms 44208 KB Output is correct
149 Correct 1624 ms 44616 KB Output is correct
150 Correct 1720 ms 44352 KB Output is correct
151 Correct 1603 ms 44556 KB Output is correct
152 Correct 1604 ms 47692 KB Output is correct
153 Correct 1757 ms 44584 KB Output is correct
154 Correct 1732 ms 45864 KB Output is correct
155 Correct 29 ms 3412 KB Output is correct
156 Correct 30 ms 3412 KB Output is correct
157 Correct 29 ms 3416 KB Output is correct
158 Correct 29 ms 3252 KB Output is correct
159 Correct 30 ms 3416 KB Output is correct
160 Correct 31 ms 3416 KB Output is correct
161 Correct 31 ms 3668 KB Output is correct
162 Correct 30 ms 3400 KB Output is correct
163 Correct 30 ms 3392 KB Output is correct
164 Correct 219 ms 15160 KB Output is correct
165 Correct 228 ms 14148 KB Output is correct
166 Correct 221 ms 13360 KB Output is correct
167 Correct 223 ms 13892 KB Output is correct
168 Correct 223 ms 13376 KB Output is correct
169 Correct 228 ms 15056 KB Output is correct
170 Correct 30 ms 3416 KB Output is correct
171 Correct 31 ms 3412 KB Output is correct
172 Correct 40 ms 3416 KB Output is correct
173 Correct 31 ms 3416 KB Output is correct
174 Correct 72 ms 3416 KB Output is correct
175 Correct 227 ms 13376 KB Output is correct
176 Correct 241 ms 15132 KB Output is correct
177 Correct 256 ms 14400 KB Output is correct
178 Correct 714 ms 14908 KB Output is correct
179 Correct 3873 ms 104584 KB Output is correct
180 Correct 3919 ms 105608 KB Output is correct
181 Correct 3804 ms 104484 KB Output is correct
182 Correct 3872 ms 105224 KB Output is correct
183 Correct 3972 ms 104744 KB Output is correct
184 Correct 3972 ms 105348 KB Output is correct
185 Correct 4266 ms 104564 KB Output is correct
186 Execution timed out 5044 ms 105092 KB Time limit exceeded
187 Halted 0 ms 0 KB -