Submission #877094

# Submission time Handle Problem Language Result Execution time Memory
877094 2023-11-22T20:47:09 Z SorahISA Cookies (JOI23_cookies) C++17
100 / 100
234 ms 237196 KB
#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA

const int maxS = 15'000 + 5;

void solve() {
    /**
     * Score: 100 points
     * Time Complexity: O(S^2 log S / w)
     * Space Complexity: O(S^2 log S / w + N^2)
    **/
    
    int N, S = 0; cin >> N;
    
    vector<int> A(N);
    Prior<pii> pq;
    for (int i = 0; i < N; ++i) cin >> A[i], S += A[i], pq.ee(A[i], i+1);
    
    vector<int> lim(S+1, 0);
    for (int i = 1; i <= S; ++i) {
        for (int x : A) lim[i] += min(i, x);
    }
    // debug(lim);
    
    int M; cin >> M;
    
    vector<int> B(M), box(N+1, 0);
    for (int &x : B) cin >> x, box[x] = 1;
    
    bitset<maxS> one; one.set();
    Vec<2, bitset<maxS>> dp(S+1);
    dp[0].resize(N + 1);
    for (int j = 1; j <= N; ++j) dp[0][j][0] = 1;
    for (int i = 1; i <= S; ++i) {
        dp[i].resize(min(N, S/i) + 2);
        for (int j = min(N, S/i); j >= 1; --j) {
            if (box[j]) dp[i][j] = (one >> (maxS - lim[i] - 1)) & (dp[i][j+1] | (dp[i-1][j] << j));
            else        dp[i][j] = (one >> (maxS - lim[i] - 1)) & dp[i][j+1];
        }
        // debug(dp[i]);
        if (dp[i][1][S]) {
            print(i);
            int nowI = i, nowS = S, nowB = 1;
            while (nowS) {
                while (!box[nowB] or !dp[nowI-1][nowB][nowS-nowB]) ++nowB;
                
                vector<pii> tmp;
                for (int j = 0; j < nowB; ++j) tmp.eb(pq.top()), pq.pop();
                cout << nowB;
                for (auto [x, id] : tmp) cout << " " << id, pq.ee(x-1, id);
                cout << "\n";
                
                --nowI, nowS -= nowB;
            }
            return;
        }
    }
    print(-1);
}

void solve_2() {
    /**
     * Score: 78 points (Subtask 1,3,4,5)
     * Time Complexity: O(S^2 log S)
     * Space Complexity: O(S^2 log S / w)
    **/
    
    int N, S = 0; cin >> N;
    
    vector<pii> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i].first, A[i].second = i + 1, S += A[i].first;
    
    vector<int> lim(S+1, 0);
    for (int i = 1; i <= S; ++i) {
        for (auto [x, id] : A) lim[i] += min(i, x);
    }
    // debug(lim);
    
    int M; cin >> M;
    
    vector<int> B(M), box(N+1, 0);
    for (int &x : B) cin >> x, box[x] = 1;
    
    Vec<2, bitset<maxS>> dp(S+1);
    dp[0].resize(N + 1);
    for (int j = 1; j <= N; ++j) dp[0][j][0] = 1;
    for (int i = 1; i <= S; ++i) {
        dp[i].resize(min(N, S/i) + 1);
        for (int j = min(N, S/i); j >= 1; --j) {
            for (int k = lim[i]; k >= 0; --k) {
                dp[i][j][k] = (j+1 < SZ(dp[i]) ? dp[i][j+1][k] : 0) | ((k >= j and box[j]) ? dp[i-1][j][k-j] : 0);
            }
        }
        // debug(dp[i]);
        if (dp[i][1][S]) {
            print(i);
            int nowI = i, nowS = S, nowB = 1;
            while (nowS) {
                while (!box[nowB] or !dp[nowI-1][nowB][nowS-nowB]) ++nowB;
                
                sort(RALL(A));
                cout << nowB;
                for (int j = 0; j < nowB; ++j) cout << " " << A[j].second, --A[j].first;
                cout << "\n";
                
                --nowI, nowS -= nowB;
            }
            return;
        }
    }
    print(-1);
}

void solve_1() {
    /**
     * Score: 63 points (Subtask 1,3,4)
     * Time Complexity: O(NS^2)
     * Space Complexity: O(NS^2 / w)
    **/
    
    int N, S = 0; cin >> N;
    
    vector<pii> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i].first, A[i].second = i + 1, S += A[i].first;
    
    vector<int> lim(S+1, 0);
    for (int i = 1; i <= S; ++i) {
        for (auto [x, id] : A) lim[i] += min(i, x);
    }
    // debug(lim);
    
    int M; cin >> M;
    
    vector<int> B(M), box(N+1, 0);
    for (int &x : B) cin >> x, box[x] = 1;
    
    Vec<2, bitset<maxS>> dp(S+1, N+1);
    for (int j = 1; j <= N; ++j) dp[0][j][0] = 1;
    for (int i = 1; i <= S; ++i) {
        for (int j = N; j >= 1; --j) {
            for (int k = lim[i]; k >= 0; --k) {
                dp[i][j][k] = (j < N ? dp[i][j+1][k] : 0) | ((k >= j and box[j]) ? dp[i-1][j][k-j] : 0);
            }
        }
        // debug(dp[i]);
        if (dp[i][1][S]) {
            print(i);
            int nowI = i, nowS = S, nowB = 1;
            while (nowS) {
                while (!box[nowB] or !dp[nowI-1][nowB][nowS-nowB]) ++nowB;
                
                sort(RALL(A));
                cout << nowB;
                for (int j = 0; j < nowB; ++j) cout << " " << A[j].second, --A[j].first;
                cout << "\n";
                
                --nowI, nowS -= nowB;
            }
            return;
        }
    }
    print(-1);
}

int32_t main() {
    fastIO();
    
    int t = 1; // cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
    
    return 0;
}

#else

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;

// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())

template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
    static_assert(D >= 1, "Vector dimension must be greater than zero!");
    template <typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(args...)) {}
};

template <typename T> struct Vec<1, T> : vector<T> {
    Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};

template <class F>
inline constexpr decltype(auto) lambda_fix(F&& f) {
    return [f = std::forward<F>(f)](auto&&... args) {
        return f(f, std::forward<decltype(args)>(args)...);
    };
}

#ifdef local
#define fastIO() void()
#define debug(...) \
    _color.emplace_back("\u001b[31m"), \
    fprintf(stderr, "%sAt [%s], line %d: (%s) = ", _color.back().c_str(), __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), _color.pop_back(), \
    fprintf(stderr, "%s", _color.back().c_str())
#define print(...) \
    fprintf(stdout, "%s", "\u001b[36m"), \
    _P(__VA_ARGS__), \
    fprintf(stdout, "%s", "\u001b[0m")

deque<string> _color{"\u001b[0m"};

template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
template <typename T> concept is_iterable = requires (T _t) {begin(_t);};

template <typename T> inline void _print_err(T &&_t);
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t);
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu);

inline void _do() {cerr << "\n";};
template <typename T> inline void _do(T &&_t) {_print_err(_t), cerr << "\n";}
template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) {_print_err(_t), cerr << ", ", _do(_u...);}
#else
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(...) void()
#define print(...) _P(__VA_ARGS__)
#endif

inline void _P() {cout << "\n";};
template <typename T> inline void _P(T &&_t) {cout << _t << "\n";}
template <typename T, typename ...U> inline void _P(T &&_t, U &&..._u) {cout << _t << " ", _P(_u...);}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline int getRand(int L, int R) {
    if (L > R) swap(L, R);
    return (int)(rng() % ((uint64_t)R - L + 1) + L);
}

template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

/// below are Fast I/O and _print_err templates ///

/*
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///

#include <unistd.h>

const int S = 65536;

int OP = 0;
char OB[S];

inline char RC() {
    static char buf[S], *p = buf, *q = buf;
    return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
}

inline int RI() {
    static char c;
    int a;
    while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
    if (c == '-') {
        a = 0;
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
    }
    else {
        a = c ^ '0';
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
    }
    return a;
}

inline void WI(int n, char c = '\n') {
    static char buf[20], p;
    if (n == 0) OB[OP++] = '0';
    p = 0;
    if (n < 0) {
        OB[OP++] = '-';
        while (n) buf[p++] = '0' - (n % 10), n /= 10;
    }
    else {
        while (n) buf[p++] = '0' + (n % 10), n /= 10;
    }
    for (--p; p >= 0; --p) OB[OP++] = buf[p];
    OB[OP++] = c;
    if (OP > S-20) write(1, OB, OP), OP = 0;
}

/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
*/

#ifdef local

template <typename T> inline void _print_err(T &&_t) {cerr << _t;}

template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "[";
    for (bool _first = true; auto &_x : _t) {
        if (!_first) cerr << ", ";
        _print_err(_x), _first = false;
    }
    cerr << "]" << (_color.pop_back(), _color.back());
}

template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "(";
    _print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
    cerr << ")" << (_color.pop_back(), _color.back());
    return os;
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

#endif

#endif
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 9052 KB Output is correct
9 Correct 1 ms 2140 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 5 ms 9052 KB Output is correct
12 Correct 3 ms 4188 KB Output is correct
13 Correct 4 ms 7772 KB Output is correct
14 Correct 2 ms 4696 KB Output is correct
15 Correct 3 ms 5720 KB Output is correct
16 Correct 2 ms 3164 KB Output is correct
17 Correct 3 ms 4956 KB Output is correct
18 Correct 4 ms 4700 KB Output is correct
19 Correct 2 ms 3676 KB Output is correct
20 Correct 2 ms 3316 KB Output is correct
21 Correct 2 ms 2648 KB Output is correct
22 Correct 5 ms 9052 KB Output is correct
23 Correct 5 ms 8996 KB Output is correct
24 Correct 2 ms 4444 KB Output is correct
25 Correct 2 ms 4444 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4440 KB Output is correct
28 Correct 2 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 5 ms 9052 KB Output is correct
6 Correct 1 ms 2140 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 2 ms 3164 KB Output is correct
9 Correct 9 ms 16988 KB Output is correct
10 Correct 43 ms 83644 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 600 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 1884 KB Output is correct
17 Correct 3 ms 5212 KB Output is correct
18 Correct 37 ms 65728 KB Output is correct
19 Correct 104 ms 184708 KB Output is correct
20 Correct 52 ms 82256 KB Output is correct
21 Correct 32 ms 48720 KB Output is correct
22 Correct 18 ms 29272 KB Output is correct
23 Correct 3 ms 3672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 9052 KB Output is correct
9 Correct 1 ms 2140 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 5 ms 9052 KB Output is correct
12 Correct 3 ms 4188 KB Output is correct
13 Correct 4 ms 7772 KB Output is correct
14 Correct 2 ms 4696 KB Output is correct
15 Correct 3 ms 5720 KB Output is correct
16 Correct 2 ms 3164 KB Output is correct
17 Correct 3 ms 4956 KB Output is correct
18 Correct 4 ms 4700 KB Output is correct
19 Correct 2 ms 3676 KB Output is correct
20 Correct 2 ms 3316 KB Output is correct
21 Correct 2 ms 2648 KB Output is correct
22 Correct 5 ms 9052 KB Output is correct
23 Correct 5 ms 8996 KB Output is correct
24 Correct 2 ms 4444 KB Output is correct
25 Correct 2 ms 4444 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4440 KB Output is correct
28 Correct 2 ms 4444 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 528 KB Output is correct
67 Correct 2 ms 3164 KB Output is correct
68 Correct 1 ms 1884 KB Output is correct
69 Correct 2 ms 5368 KB Output is correct
70 Correct 2 ms 3520 KB Output is correct
71 Correct 2 ms 2908 KB Output is correct
72 Correct 2 ms 3164 KB Output is correct
73 Correct 2 ms 3164 KB Output is correct
74 Correct 2 ms 2904 KB Output is correct
75 Correct 2 ms 3160 KB Output is correct
76 Correct 2 ms 3416 KB Output is correct
77 Correct 1 ms 2652 KB Output is correct
78 Correct 2 ms 3164 KB Output is correct
79 Correct 2 ms 3932 KB Output is correct
80 Correct 1 ms 2396 KB Output is correct
81 Correct 1 ms 1884 KB Output is correct
82 Correct 1 ms 2140 KB Output is correct
83 Correct 1 ms 2140 KB Output is correct
84 Correct 1 ms 2140 KB Output is correct
85 Correct 2 ms 3420 KB Output is correct
86 Correct 1 ms 1628 KB Output is correct
87 Correct 1 ms 1884 KB Output is correct
88 Correct 1 ms 2140 KB Output is correct
89 Correct 1 ms 2140 KB Output is correct
90 Correct 2 ms 2396 KB Output is correct
91 Correct 2 ms 2652 KB Output is correct
92 Correct 2 ms 2652 KB Output is correct
93 Correct 3 ms 5468 KB Output is correct
94 Correct 3 ms 4956 KB Output is correct
95 Correct 1 ms 2136 KB Output is correct
96 Correct 2 ms 2652 KB Output is correct
97 Correct 2 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 9052 KB Output is correct
9 Correct 1 ms 2140 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 5 ms 9052 KB Output is correct
12 Correct 3 ms 4188 KB Output is correct
13 Correct 4 ms 7772 KB Output is correct
14 Correct 2 ms 4696 KB Output is correct
15 Correct 3 ms 5720 KB Output is correct
16 Correct 2 ms 3164 KB Output is correct
17 Correct 3 ms 4956 KB Output is correct
18 Correct 4 ms 4700 KB Output is correct
19 Correct 2 ms 3676 KB Output is correct
20 Correct 2 ms 3316 KB Output is correct
21 Correct 2 ms 2648 KB Output is correct
22 Correct 5 ms 9052 KB Output is correct
23 Correct 5 ms 8996 KB Output is correct
24 Correct 2 ms 4444 KB Output is correct
25 Correct 2 ms 4444 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4440 KB Output is correct
28 Correct 2 ms 4444 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
60 Correct 0 ms 344 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 528 KB Output is correct
67 Correct 2 ms 3164 KB Output is correct
68 Correct 1 ms 1884 KB Output is correct
69 Correct 2 ms 5368 KB Output is correct
70 Correct 2 ms 3520 KB Output is correct
71 Correct 2 ms 2908 KB Output is correct
72 Correct 2 ms 3164 KB Output is correct
73 Correct 2 ms 3164 KB Output is correct
74 Correct 2 ms 2904 KB Output is correct
75 Correct 2 ms 3160 KB Output is correct
76 Correct 2 ms 3416 KB Output is correct
77 Correct 1 ms 2652 KB Output is correct
78 Correct 2 ms 3164 KB Output is correct
79 Correct 2 ms 3932 KB Output is correct
80 Correct 1 ms 2396 KB Output is correct
81 Correct 1 ms 1884 KB Output is correct
82 Correct 1 ms 2140 KB Output is correct
83 Correct 1 ms 2140 KB Output is correct
84 Correct 1 ms 2140 KB Output is correct
85 Correct 2 ms 3420 KB Output is correct
86 Correct 1 ms 1628 KB Output is correct
87 Correct 1 ms 1884 KB Output is correct
88 Correct 1 ms 2140 KB Output is correct
89 Correct 1 ms 2140 KB Output is correct
90 Correct 2 ms 2396 KB Output is correct
91 Correct 2 ms 2652 KB Output is correct
92 Correct 2 ms 2652 KB Output is correct
93 Correct 3 ms 5468 KB Output is correct
94 Correct 3 ms 4956 KB Output is correct
95 Correct 1 ms 2136 KB Output is correct
96 Correct 2 ms 2652 KB Output is correct
97 Correct 2 ms 3164 KB Output is correct
98 Correct 9 ms 16988 KB Output is correct
99 Correct 2 ms 3924 KB Output is correct
100 Correct 7 ms 9564 KB Output is correct
101 Correct 6 ms 10272 KB Output is correct
102 Correct 7 ms 10076 KB Output is correct
103 Correct 6 ms 10584 KB Output is correct
104 Correct 7 ms 10844 KB Output is correct
105 Correct 9 ms 13916 KB Output is correct
106 Correct 27 ms 39764 KB Output is correct
107 Correct 21 ms 33372 KB Output is correct
108 Correct 6 ms 9820 KB Output is correct
109 Correct 11 ms 17184 KB Output is correct
110 Correct 11 ms 19548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 5 ms 9052 KB Output is correct
9 Correct 1 ms 2140 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 5 ms 9052 KB Output is correct
12 Correct 3 ms 4188 KB Output is correct
13 Correct 4 ms 7772 KB Output is correct
14 Correct 2 ms 4696 KB Output is correct
15 Correct 3 ms 5720 KB Output is correct
16 Correct 2 ms 3164 KB Output is correct
17 Correct 3 ms 4956 KB Output is correct
18 Correct 4 ms 4700 KB Output is correct
19 Correct 2 ms 3676 KB Output is correct
20 Correct 2 ms 3316 KB Output is correct
21 Correct 2 ms 2648 KB Output is correct
22 Correct 5 ms 9052 KB Output is correct
23 Correct 5 ms 8996 KB Output is correct
24 Correct 2 ms 4444 KB Output is correct
25 Correct 2 ms 4444 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4440 KB Output is correct
28 Correct 2 ms 4444 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 5 ms 9052 KB Output is correct
34 Correct 1 ms 2140 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 2 ms 3164 KB Output is correct
37 Correct 9 ms 16988 KB Output is correct
38 Correct 43 ms 83644 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 600 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 1884 KB Output is correct
45 Correct 3 ms 5212 KB Output is correct
46 Correct 37 ms 65728 KB Output is correct
47 Correct 104 ms 184708 KB Output is correct
48 Correct 52 ms 82256 KB Output is correct
49 Correct 32 ms 48720 KB Output is correct
50 Correct 18 ms 29272 KB Output is correct
51 Correct 3 ms 3672 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 344 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 1 ms 344 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 344 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 0 ms 344 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 1 ms 528 KB Output is correct
90 Correct 2 ms 3164 KB Output is correct
91 Correct 1 ms 1884 KB Output is correct
92 Correct 2 ms 5368 KB Output is correct
93 Correct 2 ms 3520 KB Output is correct
94 Correct 2 ms 2908 KB Output is correct
95 Correct 2 ms 3164 KB Output is correct
96 Correct 2 ms 3164 KB Output is correct
97 Correct 2 ms 2904 KB Output is correct
98 Correct 2 ms 3160 KB Output is correct
99 Correct 2 ms 3416 KB Output is correct
100 Correct 1 ms 2652 KB Output is correct
101 Correct 2 ms 3164 KB Output is correct
102 Correct 2 ms 3932 KB Output is correct
103 Correct 1 ms 2396 KB Output is correct
104 Correct 1 ms 1884 KB Output is correct
105 Correct 1 ms 2140 KB Output is correct
106 Correct 1 ms 2140 KB Output is correct
107 Correct 1 ms 2140 KB Output is correct
108 Correct 2 ms 3420 KB Output is correct
109 Correct 1 ms 1628 KB Output is correct
110 Correct 1 ms 1884 KB Output is correct
111 Correct 1 ms 2140 KB Output is correct
112 Correct 1 ms 2140 KB Output is correct
113 Correct 2 ms 2396 KB Output is correct
114 Correct 2 ms 2652 KB Output is correct
115 Correct 2 ms 2652 KB Output is correct
116 Correct 3 ms 5468 KB Output is correct
117 Correct 3 ms 4956 KB Output is correct
118 Correct 1 ms 2136 KB Output is correct
119 Correct 2 ms 2652 KB Output is correct
120 Correct 2 ms 3164 KB Output is correct
121 Correct 9 ms 16988 KB Output is correct
122 Correct 2 ms 3924 KB Output is correct
123 Correct 7 ms 9564 KB Output is correct
124 Correct 6 ms 10272 KB Output is correct
125 Correct 7 ms 10076 KB Output is correct
126 Correct 6 ms 10584 KB Output is correct
127 Correct 7 ms 10844 KB Output is correct
128 Correct 9 ms 13916 KB Output is correct
129 Correct 27 ms 39764 KB Output is correct
130 Correct 21 ms 33372 KB Output is correct
131 Correct 6 ms 9820 KB Output is correct
132 Correct 11 ms 17184 KB Output is correct
133 Correct 11 ms 19548 KB Output is correct
134 Correct 28 ms 47796 KB Output is correct
135 Correct 33 ms 47960 KB Output is correct
136 Correct 45 ms 50772 KB Output is correct
137 Correct 46 ms 73044 KB Output is correct
138 Correct 65 ms 62076 KB Output is correct
139 Correct 52 ms 67328 KB Output is correct
140 Correct 234 ms 237196 KB Output is correct
141 Correct 192 ms 187728 KB Output is correct
142 Correct 33 ms 47956 KB Output is correct
143 Correct 71 ms 89404 KB Output is correct
144 Correct 102 ms 92368 KB Output is correct