답안 #396893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
396893 2021-04-30T23:03:34 Z duality Dungeon 3 (JOI21_ho_t5) C++11
100 / 100
3289 ms 573196 KB
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int N;
int A[200000],B[200000],S[200000],T[200000],U[200000];
LLI pre[200001];
int l[200000],r[200000];
vi s;
int sparse[200000][18],logg[200001];
pii sparse2[200000][18];
int query(int s,int e) {
    int l = logg[e-s+1];
    return max(sparse[s][l],sparse[e-(1 << l)+1][l]);
}
int query2(int s,int e) {
    int l = logg[e-s+1];
    return min(sparse2[s][l],sparse2[e-(1 << l)+1][l]).second;
}
LLI ans[200000];
vpii queries;
struct event {
    int l,r,w;
    LLI x;
};
vector<event> events;
bool comp(event a,event b) {
    return a.x < b.x;
}
LLI bit[200001];
struct data {
    vector<pair<pii,LLI> > vv;
    int update(int i,LLI num) {
        vv.pb(mp(mp(i,-1),num));
        return 0;
    }
    int query(int i,int a,LLI w) {
        vv.pb(mp(mp(i,a),w));
        return 0;
    }
    int process() {
        int i,j;
        for (i = 0; i < vv.size(); i++) {
            if (vv[i].first.second == -1) {
                for (j = vv[i].first.first+1; j <= N; j += j & (-j)) bit[j] += vv[i].second;
            }
            else {
                for (j = vv[i].first.first+1; j > 0; j -= j & (-j)) ans[vv[i].first.second] += vv[i].second*bit[j];
            }
        }
        for (i = 0; i < vv.size(); i++) {
            if (vv[i].first.second == -1) {
                for (j = vv[i].first.first+1; j <= N; j += j & (-j)) bit[j] = 0;
            }
        }
        vv.clear();
        return 0;
    }
};
data bit1[200001],bit2[200001];
int parent[200000][18],logn;
int parent2[200000][18];
int disc[200000],fin[200000],num = 0;
vi adjList[200000];
int doDFS(int u) {
    int i;
    disc[u] = num++;
    for (i = 0; i < adjList[u].size(); i++) doDFS(adjList[u][i]);
    fin[u] = num;
    return 0;
}
LLI sum[200000],sum2[200000],sum3[200000];
int main() {
    int i;
    int M;
    scanf("%d %d",&N,&M);
    for (i = 0; i < N; i++) scanf("%d",&A[i]),pre[i+1] = pre[i]+A[i];
    for (i = 0; i < N; i++) scanf("%d",&B[i]);
    for (i = 0; i < M; i++) scanf("%d %d %d",&S[i],&T[i],&U[i]),S[i]--,T[i] -= 2;

    int j;
    for (i = 0; i < N; i++) {
        while (!s.empty() && (B[s.back()] > B[i])) s.pop_back();
        if (s.empty()) l[i] = -1;
        else l[i] = s.back();
        s.pb(i);
    }
    s.clear();
    for (i = N-1; i >= 0; i--) {
        while (!s.empty() && (B[s.back()] >= B[i])) s.pop_back();
        if (s.empty()) r[i] = N;
        else r[i] = s.back();
        s.pb(i);
    }
    for (i = 0; i < N; i++) sparse[i][0] = A[i],sparse2[i][0] = mp(B[i],i);
    for (i = 1; (1 << i) <= N; i++) {
        for (j = 0; j <= N-(1 << i); j++) {
            sparse[j][i] = max(sparse[j][i-1],sparse[j+(1 << (i-1))][i-1]);
            sparse2[j][i] = min(sparse2[j][i-1],sparse2[j+(1 << (i-1))][i-1]);
        }
    }
    for (i = 2; i <= N; i++) logg[i] = logg[i/2]+1;
    for (i = 0; i < N; i++) parent[i][0] = l[i];
    for (i = 1; (1 << i) < N; i++) {
        for (j = 0; j < N; j++) {
            if (parent[j][i-1] != -1) parent[j][i] = parent[parent[j][i-1]][i-1];
            else parent[j][i] = -1;
        }
    }
    for (i = N-1; i >= 0; i--) parent2[i][0] = r[i];
    for (i = 1; (1 << i) < N; i++) {
        for (j = 0; j < N; j++) {
            if (parent2[j][i-1] != N) parent2[j][i] = parent2[parent2[j][i-1]][i-1];
            else parent2[j][i] = N;
        }
    }
    logn = i;

    int k;
    for (i = 0; i < M; i++) {
        if (query(S[i],T[i]) > U[i]) ans[i] = -1;
        else queries.pb(mp(U[i],i));
    }
    sort(queries.begin(),queries.end());
    for (i = 0; i < N; i++) {
        if ((l[i] >= 0) && (r[i] < N)) {
            events.pb((event){l[i],r[i],-B[i],pre[r[i]]-pre[l[i]]});
            events.pb((event){l[i],r[i],B[i],pre[r[i]]-pre[i]});
            events.pb((event){l[i],r[i],B[i],pre[i]-pre[l[i]]});
        }
    }
    sort(events.begin(),events.end(),comp);
    for (i = 0; i < events.size(); i++) {
        for (k = events[i].l+1; k > 0; k -= k & (-k)) bit2[k].update(events[i].r,events[i].w);
    }
    j = 0;
    for (i = 0; i < queries.size(); i++) {
        while ((j < events.size()) && (events[j].x < queries[i].first)) {
            for (k = events[j].l+1; k > 0; k -= k & (-k)) {
                bit2[k].update(events[j].r,-events[j].w);
                bit1[k].update(events[j].r,events[j].x*events[j].w);
            }
            j++;
        }
        for (k = S[queries[i].second]+1; k <= N; k += k & (-k)) {
            bit1[k].query(T[queries[i].second],queries[i].second,1);
            bit2[k].query(T[queries[i].second],queries[i].second,queries[i].first);
        }
    }
    for (i = 0; i <= N; i++) bit1[i].process(),bit2[i].process();

    for (i = 0; i < N; i++) {
        if (r[i] != N) adjList[r[i]].pb(i);
    }
    for (i = 0; i < N; i++) {
        if (r[i] == N) doDFS(i);
    }
    events.clear();
    for (i = 0; i < N; i++) {
        if (r[i] < N) events.pb((event){i,i,B[i],pre[r[i]]-pre[i]});
    }
    sort(events.begin(),events.end(),comp);
    for (i = 0; i < events.size(); i++) {
        bit2[0].update(disc[events[i].l],events[i].w);
        bit2[0].update(fin[events[i].l],-events[i].w);
    }
    j = 0;
    for (i = 0; i < queries.size(); i++) {
        while ((j < events.size()) && (events[j].x < queries[i].first)) {
            bit2[0].update(disc[events[j].l],-events[j].w);
            bit2[0].update(fin[events[j].l],events[j].w);
            bit1[0].update(disc[events[j].l],events[j].x*events[j].w);
            bit1[0].update(fin[events[j].l],-events[j].x*events[j].w);
            j++;
        }

        bit1[0].query(disc[S[queries[i].second]],queries[i].second,1);
        bit2[0].query(disc[S[queries[i].second]],queries[i].second,queries[i].first);
        int u = S[queries[i].second];
        for (k = logn-1; k >= 0; k--) {
            if (parent2[u][k] <= T[queries[i].second]) u = parent2[u][k];
        }
        bit1[0].query(disc[u],queries[i].second,-1);
        bit2[0].query(disc[u],queries[i].second,-queries[i].first);
    }
    bit1[0].process(),bit2[0].process();
    num = 0;
    for (i = 0; i < N; i++) adjList[i].clear();
    for (i = 0; i < N; i++) {
        if (l[i] != -1) adjList[l[i]].pb(i);
    }
    for (i = 0; i < N; i++) {
        if (l[i] == -1) doDFS(i);
    }
    events.clear();
    for (i = 0; i < N; i++) {
        if (l[i] >= 0) events.pb((event){i,i,B[i],pre[i]-pre[l[i]]});
    }
    sort(events.begin(),events.end(),comp);
    for (i = 0; i < events.size(); i++) {
        bit2[0].update(disc[events[i].l],events[i].w);
        bit2[0].update(fin[events[i].l],-events[i].w);
    }
    j = 0;
    for (i = 0; i < queries.size(); i++) {
        while ((j < events.size()) && (events[j].x < queries[i].first)) {
            bit2[0].update(disc[events[j].l],-events[j].w);
            bit2[0].update(fin[events[j].l],events[j].w);
            bit1[0].update(disc[events[j].l],events[j].x*events[j].w);
            bit1[0].update(fin[events[j].l],-events[j].x*events[j].w);
            j++;
        }

        bit1[0].query(disc[T[queries[i].second]],queries[i].second,1);
        bit2[0].query(disc[T[queries[i].second]],queries[i].second,queries[i].first);
        int u = T[queries[i].second];
        for (k = logn-1; k >= 0; k--) {
            if (parent[u][k] >= S[queries[i].second]) u = parent[u][k];
        }
        bit1[0].query(disc[u],queries[i].second,-1);
        bit2[0].query(disc[u],queries[i].second,-queries[i].first);
    }
    bit1[0].process(),bit2[0].process();
    for (i = 0; i < N; i++) {
        sum[i] = pre[i],sum2[i] = B[i],sum3[i] = pre[i]*B[i];
        if (l[i] != -1) {
            sum[i] += sum[l[i]];
            sum2[i] += sum2[l[i]];
            sum3[i] += sum3[l[i]];
        }
    }
    for (i = 0; i < M; i++) {
        if (query(S[i],T[i]) <= U[i]) {
            int u = T[i];
            for (j = logn-1; j >= 0; j--) {
                if ((parent[u][j] >= S[i]) && (pre[T[i]+1]-pre[parent[u][j]] < U[i])) {
                    ans[i] += (sum2[u]-sum2[parent[u][j]])*pre[T[i]+1];
                    ans[i] -= sum3[u]-sum3[parent[u][j]];
                    u = parent[u][j];
                }
            }
            while ((parent[u][0] >= S[i]) && (pre[T[i]+1]-pre[u] < U[i])) {
                ans[i] += (sum2[u]-sum2[parent[u][0]])*pre[T[i]+1];
                ans[i] -= sum3[u]-sum3[parent[u][0]];
                u = parent[u][0];
            }
            for (j = logn-1; j >= 0; j--) {
                if (parent[u][j] >= S[i]) {
                    ans[i] += (sum2[u]-sum2[parent[u][j]])*U[i];
                    u = parent[u][j];
                }
            }
            j = query2(S[i],T[i]);
            LLI b = min(pre[T[i]+1]-pre[j],(LLI) U[i]);
            ans[i] += b*B[j];
        }
    }
    for (i = 0; i < N; i++) {
        if (l[i] != -1) {
            sum[i] = pre[l[i]],sum2[i] = B[i],sum3[i] = pre[l[i]]*B[i];
            sum[i] += sum[l[i]];
            sum2[i] += sum2[l[i]];
            sum3[i] += sum3[l[i]];
        }
        else sum[i] = sum2[i] = sum3[i] = 0;
    }
    for (i = 0; i < M; i++) {
        if (query(S[i],T[i]) <= U[i]) {
            int u = T[i];
            for (j = logn-1; j >= 0; j--) {
                if ((parent[u][j] >= S[i]) && (l[parent[u][j]] >= S[i]) && (pre[T[i]+1]-pre[l[parent[u][j]]] < U[i])) {
                    ans[i] -= (sum2[u]-sum2[parent[u][j]])*pre[T[i]+1];
                    ans[i] += sum3[u]-sum3[parent[u][j]];
                    u = parent[u][j];
                }
            }
            while ((parent[u][0] >= S[i]) && (pre[T[i]+1]-pre[l[u]] < U[i])) {
                ans[i] -= (sum2[u]-sum2[parent[u][0]])*pre[T[i]+1];
                ans[i] += sum3[u]-sum3[parent[u][0]];
                u = parent[u][0];
            }
            for (j = logn-1; j >= 0; j--) {
                if (parent[u][j] >= S[i]) {
                    ans[i] -= (sum2[u]-sum2[parent[u][j]])*U[i];
                    u = parent[u][j];
                }
            }
        }
    }
    for (i = 0; i < M; i++) printf("%lld\n",ans[i]);

    return 0;
}

Compilation message

Main.cpp: In member function 'int data::process()':
Main.cpp:96:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |         for (i = 0; i < vv.size(); i++) {
      |                     ~~^~~~~~~~~~~
Main.cpp:104:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |         for (i = 0; i < vv.size(); i++) {
      |                     ~~^~~~~~~~~~~
Main.cpp: In function 'int doDFS(int)':
Main.cpp:121:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  121 |     for (i = 0; i < adjList[u].size(); i++) doDFS(adjList[u][i]);
      |                 ~~^~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:186:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  186 |     for (i = 0; i < events.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:190:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  190 |     for (i = 0; i < queries.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
Main.cpp:191:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  191 |         while ((j < events.size()) && (events[j].x < queries[i].first)) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:216:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  216 |     for (i = 0; i < events.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:221:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  221 |     for (i = 0; i < queries.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
Main.cpp:222:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  222 |         while ((j < events.size()) && (events[j].x < queries[i].first)) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:253:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  253 |     for (i = 0; i < events.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:258:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  258 |     for (i = 0; i < queries.size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
Main.cpp:259:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<event>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  259 |         while ((j < events.size()) && (events[j].x < queries[i].first)) {
      |                 ~~^~~~~~~~~~~~~~~
Main.cpp:129:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  129 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
Main.cpp:130:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  130 |     for (i = 0; i < N; i++) scanf("%d",&A[i]),pre[i+1] = pre[i]+A[i];
      |                             ~~~~~^~~~~~~~~~~~
Main.cpp:131:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  131 |     for (i = 0; i < N; i++) scanf("%d",&B[i]);
      |                             ~~~~~^~~~~~~~~~~~
Main.cpp:132:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  132 |     for (i = 0; i < M; i++) scanf("%d %d %d",&S[i],&T[i],&U[i]),S[i]--,T[i] -= 2;
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 20704 KB Output is correct
2 Correct 19 ms 17736 KB Output is correct
3 Correct 19 ms 17692 KB Output is correct
4 Correct 31 ms 20788 KB Output is correct
5 Correct 19 ms 17788 KB Output is correct
6 Correct 19 ms 17800 KB Output is correct
7 Correct 32 ms 20824 KB Output is correct
8 Correct 19 ms 17996 KB Output is correct
9 Correct 18 ms 17824 KB Output is correct
10 Correct 32 ms 20736 KB Output is correct
11 Correct 21 ms 17832 KB Output is correct
12 Correct 18 ms 17800 KB Output is correct
13 Correct 34 ms 21128 KB Output is correct
14 Correct 24 ms 19184 KB Output is correct
15 Correct 24 ms 19164 KB Output is correct
16 Correct 30 ms 20856 KB Output is correct
17 Correct 31 ms 20400 KB Output is correct
18 Correct 18 ms 17356 KB Output is correct
19 Correct 17 ms 17412 KB Output is correct
20 Correct 19 ms 17992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 310 ms 94608 KB Output is correct
2 Correct 540 ms 136740 KB Output is correct
3 Correct 266 ms 72108 KB Output is correct
4 Correct 228 ms 69844 KB Output is correct
5 Correct 610 ms 140072 KB Output is correct
6 Correct 1455 ms 299396 KB Output is correct
7 Correct 2601 ms 521724 KB Output is correct
8 Correct 1742 ms 252276 KB Output is correct
9 Correct 1254 ms 245336 KB Output is correct
10 Correct 2770 ms 453096 KB Output is correct
11 Correct 1826 ms 247352 KB Output is correct
12 Correct 1263 ms 245612 KB Output is correct
13 Correct 3208 ms 564860 KB Output is correct
14 Correct 3203 ms 564420 KB Output is correct
15 Correct 854 ms 284248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3149 ms 537516 KB Output is correct
2 Correct 1499 ms 236824 KB Output is correct
3 Correct 1114 ms 229236 KB Output is correct
4 Correct 2850 ms 553560 KB Output is correct
5 Correct 1366 ms 284776 KB Output is correct
6 Correct 1930 ms 432096 KB Output is correct
7 Correct 2891 ms 516796 KB Output is correct
8 Correct 1227 ms 220756 KB Output is correct
9 Correct 972 ms 216752 KB Output is correct
10 Correct 858 ms 270924 KB Output is correct
11 Correct 1344 ms 299032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 20704 KB Output is correct
2 Correct 19 ms 17736 KB Output is correct
3 Correct 19 ms 17692 KB Output is correct
4 Correct 31 ms 20788 KB Output is correct
5 Correct 19 ms 17788 KB Output is correct
6 Correct 19 ms 17800 KB Output is correct
7 Correct 32 ms 20824 KB Output is correct
8 Correct 19 ms 17996 KB Output is correct
9 Correct 18 ms 17824 KB Output is correct
10 Correct 32 ms 20736 KB Output is correct
11 Correct 21 ms 17832 KB Output is correct
12 Correct 18 ms 17800 KB Output is correct
13 Correct 34 ms 21128 KB Output is correct
14 Correct 24 ms 19184 KB Output is correct
15 Correct 24 ms 19164 KB Output is correct
16 Correct 30 ms 20856 KB Output is correct
17 Correct 31 ms 20400 KB Output is correct
18 Correct 18 ms 17356 KB Output is correct
19 Correct 17 ms 17412 KB Output is correct
20 Correct 19 ms 17992 KB Output is correct
21 Correct 310 ms 94608 KB Output is correct
22 Correct 540 ms 136740 KB Output is correct
23 Correct 266 ms 72108 KB Output is correct
24 Correct 228 ms 69844 KB Output is correct
25 Correct 610 ms 140072 KB Output is correct
26 Correct 1455 ms 299396 KB Output is correct
27 Correct 2601 ms 521724 KB Output is correct
28 Correct 1742 ms 252276 KB Output is correct
29 Correct 1254 ms 245336 KB Output is correct
30 Correct 2770 ms 453096 KB Output is correct
31 Correct 1826 ms 247352 KB Output is correct
32 Correct 1263 ms 245612 KB Output is correct
33 Correct 3208 ms 564860 KB Output is correct
34 Correct 3203 ms 564420 KB Output is correct
35 Correct 854 ms 284248 KB Output is correct
36 Correct 3149 ms 537516 KB Output is correct
37 Correct 1499 ms 236824 KB Output is correct
38 Correct 1114 ms 229236 KB Output is correct
39 Correct 2850 ms 553560 KB Output is correct
40 Correct 1366 ms 284776 KB Output is correct
41 Correct 1930 ms 432096 KB Output is correct
42 Correct 2891 ms 516796 KB Output is correct
43 Correct 1227 ms 220756 KB Output is correct
44 Correct 972 ms 216752 KB Output is correct
45 Correct 858 ms 270924 KB Output is correct
46 Correct 1344 ms 299032 KB Output is correct
47 Correct 3289 ms 556660 KB Output is correct
48 Correct 1662 ms 243180 KB Output is correct
49 Correct 1289 ms 239052 KB Output is correct
50 Correct 2970 ms 573196 KB Output is correct
51 Correct 1587 ms 317872 KB Output is correct
52 Correct 2515 ms 460400 KB Output is correct
53 Correct 3072 ms 537072 KB Output is correct
54 Correct 1444 ms 228024 KB Output is correct
55 Correct 1089 ms 222452 KB Output is correct
56 Correct 897 ms 271020 KB Output is correct
57 Correct 1485 ms 300032 KB Output is correct