답안 #678261

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678261 2023-01-05T11:12:59 Z stanislavpolyn Diversity (CEOI21_diversity) C++17
100 / 100
5397 ms 7448 KB
#include <bits/stdc++.h>

#pragma GCC optimize("O3")

#define fr(i, a, b) for (int i = (a); i <= (b); ++i)
#define rf(i, a, b) for (int i = (a); i >= (b); --i)
#define fe(x, y) for (auto& x : y)

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define all(x) (x).begin(), (x).end()
#define pw(x) (1LL << (x))
#define sz(x) (int)(x).size()

using namespace std;

//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

mt19937_64 rng(228);


//#ifdef LOCAL
//    #define __int128 ll
//#endif // LOCAL

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order
#define ook order_of_key

template <typename T>
bool umn(T& a, T b) {
    return a > b ? a = b, 1 : 0;
}
template <typename T>
bool umx(T& a, T b) {
    return a < b ? a = b, 1 : 0;
}

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T>
using ve = vector<T>;

const int B = 560;
//
//int calc(ve<int> a) {
//    int ans = 0;
//    fr (i, 0, sz(a) - 1) {
//        set<int> s;
//        fr (j, i, sz(a) - 1) {
//            s.insert(a[j]);
//            ans += sz(s);
//        }
//    }
//    return ans;
//}
//
//
//ll calc2(ve<int> a) {
//    int total = 0;
//    fe (x, a) total += x;
//    ll ans = 0;
//    int toLeft = 0;
//    ans += 1LL * sz(a) * total * (total + 1) / 2;
//    fr (i, 0, sz(a) - 1) {
//        int toRight = total - toLeft - a[i];
//        ans -= 1LL * toLeft * (toLeft + 1) / 2;
//        ans -= 1LL * toRight * (toRight + 1) / 2;
//        toLeft += a[i];
//    }
//    return ans;
//}
//
//ll calc3Brute(ve<pii> a) {
//    assert(sz(a) <= 2 * B);
//    int total = 0;
//    int gr = 0;
//    fe (x, a) {
//        total += x.fi * x.se;
//        gr += x.se;
//    }
//    ll ans = 0;
//
//    ans += 1LL * gr * total * (total + 1) / 2;
//    int toLeft = 0;
//    fe (cur, a) {
//        fr (j, 1, cur.se) {
//            ans -= 1LL * toLeft * (toLeft + 1) / 2;
//            toLeft += cur.fi;
//        }
//    }
//    reverse(all(a));
//    toLeft = 0;
//    fe (cur, a) {
//        fr (j, 1, cur.se) {
//            ans -= 1LL * toLeft * (toLeft + 1) / 2;
//            toLeft += cur.fi;
//        }
//    }
//    return ans;
//}


ll calc3(ve<pll> a) {
    assert(sz(a) <= 2 * B);

    ll total = 0;
    ll gr = 0;
    fe (x, a) {
        total += x.fi * x.se;
        gr += x.se;
    }
    ll ans = 0;

    ans += 1LL * gr * total * (total + 1) / 2;
    ll toLeft = 0;
    fe (cur, a) {
        ll res = 0;

        res += toLeft * cur.se;
        res += cur.fi * 1LL * cur.se * (cur.se - 1) / 2;

        res += 1LL * toLeft * toLeft * cur.se;
        {
            ll t = cur.se * (cur.se - 1) / 2;
            t *= 2;
            res += t * cur.fi * toLeft;
        }

        cur.se--;
        ll sumSquares = cur.se * (cur.se + 1) * (2 * cur.se + 1) / 6;
        cur.se++;

        res += sumSquares * cur.fi * cur.fi;

        res /= 2;
        ans -= res;

        toLeft += cur.fi * cur.se;
    }
    reverse(all(a));

    toLeft = 0;
    fe (cur, a) {
        ll res = 0;

        res += toLeft * cur.se;
        res += cur.fi * 1LL * cur.se * (cur.se - 1) / 2;

        res += 1LL * toLeft * toLeft * cur.se;
        {
            ll t = cur.se * (cur.se - 1) / 2;
            t *= 2;
            res += t * cur.fi * toLeft;
        }

        cur.se--;
        ll sumSquares = cur.se * (cur.se + 1) * (2 * cur.se + 1) / 6;
        cur.se++;

        res += sumSquares * cur.fi * cur.fi;

        res /= 2;
        ans -= res;

        toLeft += cur.fi * cur.se;
    }

    return ans;
}

const int N = 6e5 + 5;

int n, q;
int a[N];

int cnt[N];

int rnd(int l, int r) {
    return rng() % (r - l + 1) + l;
}

//ll solve(ve<int> a) {
//    fe (x, a) cnt[x] = 0;
//
//    fe (x, a) cnt[x]++;
//
//    ve<pii> order;
//    fe (x, a) {
//        if (cnt[x]) {
//            order.pb({cnt[x], x});
//            cnt[x] = 0;
//        }
//    }
//    sort(all(order));
//    reverse(all(order));
//
//    {
//        ve<pii> st;
//        fe (cur, order) {
//            if (!sz(st) || cur.fi != st.back().fi) {
//                st.pb({cur.fi, 1});
//            } else {
//                st.back().se++;
//            }
//        }
//        deque<pii> d;
//        bool who = 0;
//        fe (x, st) {
//            if (x.se > 1) {
//                d.push_front({x.fi, x.se / 2});
//                d.pb({x.fi, x.se / 2});
//                x.se %= 2;
//            }
//            if (x.se) {
//                if (who == 0) {
//                    if (sz(d) && d.front().fi == x.fi) d.front().se++;
//                    else d.push_front({x.fi, 1});
//                } else {
//                    if (sz(d) && d.back().fi == x.fi) d.back().se++;
//                    else d.pb({x.fi, 1});
//                }
//                who ^= 1;
//            }
//        }
//
//        ve<pll> v;
//        ve<pii> v2;
//        fe (x, d) {
//            v.pb(x);
//            v2.pb(x);
//        }
//
////        cout << calc3Brute(v2) << "\n";
//
//        return calc3(v);
//    }
//    assert(0);
//}

ve<array<int, 3>> Q;

set<int> have;

int cnt2[N];
ll ans[N];

int toUpd[N];
int szToUpd;

void add(int x) {
    cnt2[cnt[x]]--;
    if (cnt2[cnt[x]] == 0) {
        toUpd[szToUpd++] = cnt[x];
//        have.erase(cnt[x]);
    }
    cnt[x]++;
    cnt2[cnt[x]]++;
    if (cnt2[cnt[x]] == 1) {
        toUpd[szToUpd++] = cnt[x];
//        have.insert(cnt[x]);
    }
}

void del(int x) {
    cnt2[cnt[x]]--;
    if (cnt2[cnt[x]] == 0) {
        toUpd[szToUpd++] = cnt[x];
//        have.erase(cnt[x]);
    }
    cnt[x]--;
    cnt2[cnt[x]]++;
    if (cnt2[cnt[x]] == 1) {
        toUpd[szToUpd++] = cnt[x];
//        have.insert(cnt[x]);
    }
}

ll getAns() {
    ve<pii> st;
    fe (cur, have) {
        st.pb({cur, cnt2[cur]});
    }
    reverse(all(st));

    deque<pii> d;
    bool who = 0;
    fe (x, st) {
        if (x.se > 1) {
            d.push_front({x.fi, x.se / 2});
            d.pb({x.fi, x.se / 2});
            x.se %= 2;
        }
        if (x.se) {
            if (who == 0) {
                if (sz(d) && d.front().fi == x.fi) d.front().se++;
                else d.push_front({x.fi, 1});
            } else {
                if (sz(d) && d.back().fi == x.fi) d.back().se++;
                else d.pb({x.fi, 1});
            }
            who ^= 1;
        }
    }

    ve<pll> v;
    fe (x, d) {
        v.pb(x);
    }

    return calc3(v);
}

bool check[N];

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios::sync_with_stdio(0);
    cin.tie(0);
#endif

//    cout << 3e5 * sqrt(3e5) * 9 / 1e8 << "\n";
//
//    return 0;

    cin >> n >> q;

    fr (i, 1, n) {
        cin >> a[i];
    }

    fr (i, 1, q) {
        int l, r;
        cin >> l >> r;

        Q.pb({l, r, i});
    }

    sort(all(Q), [](array<int, 3> a, array<int, 3> b) {
        if (a[0] / B != b[0] / B) {
            return a[0] / B < b[0] / B;
         }
         return a[1] < b[1];
    });

    int L = 1;
    int R = 0;

    fe (cur, Q) {
        while (R < cur[1]) add(a[++R]);
        while (L > cur[0]) add(a[--L]);
        while (R > cur[1]) del(a[R--]);
        while (L < cur[0]) del(a[L++]);

        fr (i, 0, szToUpd - 1) {
            if (!check[toUpd[i]]) {
                check[toUpd[i]] = 1;
                int x = toUpd[i];
                if (cnt2[x] == 0) {
                    have.erase(x);
                } else {
                    have.insert(x);
                }
            }
        }
        fr (i, 0, szToUpd - 1) {
            check[toUpd[i]] = 0;
        }
        szToUpd = 0;

        ans[cur[2]] = getAns();
    }

    fr (i, 1, q) {
        cout << ans[i] << "\n";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 7 ms 1620 KB Output is correct
5 Correct 14 ms 3084 KB Output is correct
6 Correct 22 ms 4180 KB Output is correct
7 Correct 24 ms 4556 KB Output is correct
8 Correct 19 ms 4052 KB Output is correct
9 Correct 20 ms 4056 KB Output is correct
10 Correct 21 ms 4376 KB Output is correct
11 Correct 23 ms 4152 KB Output is correct
12 Correct 22 ms 4052 KB Output is correct
13 Correct 21 ms 4100 KB Output is correct
14 Correct 20 ms 4224 KB Output is correct
15 Correct 20 ms 4188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 7 ms 1620 KB Output is correct
5 Correct 14 ms 3084 KB Output is correct
6 Correct 22 ms 4180 KB Output is correct
7 Correct 24 ms 4556 KB Output is correct
8 Correct 19 ms 4052 KB Output is correct
9 Correct 20 ms 4056 KB Output is correct
10 Correct 21 ms 4376 KB Output is correct
11 Correct 23 ms 4152 KB Output is correct
12 Correct 22 ms 4052 KB Output is correct
13 Correct 21 ms 4100 KB Output is correct
14 Correct 20 ms 4224 KB Output is correct
15 Correct 20 ms 4188 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 10 ms 1620 KB Output is correct
20 Correct 14 ms 2952 KB Output is correct
21 Correct 21 ms 4052 KB Output is correct
22 Correct 21 ms 4004 KB Output is correct
23 Correct 21 ms 4040 KB Output is correct
24 Correct 24 ms 4012 KB Output is correct
25 Correct 21 ms 4052 KB Output is correct
26 Correct 23 ms 4060 KB Output is correct
27 Correct 21 ms 4052 KB Output is correct
28 Correct 22 ms 4176 KB Output is correct
29 Correct 21 ms 4064 KB Output is correct
30 Correct 21 ms 4044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 7 ms 1620 KB Output is correct
5 Correct 14 ms 3084 KB Output is correct
6 Correct 22 ms 4180 KB Output is correct
7 Correct 24 ms 4556 KB Output is correct
8 Correct 19 ms 4052 KB Output is correct
9 Correct 20 ms 4056 KB Output is correct
10 Correct 21 ms 4376 KB Output is correct
11 Correct 23 ms 4152 KB Output is correct
12 Correct 22 ms 4052 KB Output is correct
13 Correct 21 ms 4100 KB Output is correct
14 Correct 20 ms 4224 KB Output is correct
15 Correct 20 ms 4188 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 10 ms 1620 KB Output is correct
20 Correct 14 ms 2952 KB Output is correct
21 Correct 21 ms 4052 KB Output is correct
22 Correct 21 ms 4004 KB Output is correct
23 Correct 21 ms 4040 KB Output is correct
24 Correct 24 ms 4012 KB Output is correct
25 Correct 21 ms 4052 KB Output is correct
26 Correct 23 ms 4060 KB Output is correct
27 Correct 21 ms 4052 KB Output is correct
28 Correct 22 ms 4176 KB Output is correct
29 Correct 21 ms 4064 KB Output is correct
30 Correct 21 ms 4044 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 468 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 4 ms 596 KB Output is correct
38 Correct 3 ms 596 KB Output is correct
39 Correct 7 ms 872 KB Output is correct
40 Correct 14 ms 1636 KB Output is correct
41 Correct 22 ms 2372 KB Output is correct
42 Correct 23 ms 2464 KB Output is correct
43 Correct 21 ms 2412 KB Output is correct
44 Correct 21 ms 2432 KB Output is correct
45 Correct 21 ms 2388 KB Output is correct
46 Correct 21 ms 2360 KB Output is correct
47 Correct 21 ms 2328 KB Output is correct
48 Correct 22 ms 2512 KB Output is correct
49 Correct 22 ms 2332 KB Output is correct
50 Correct 22 ms 2620 KB Output is correct
51 Correct 21 ms 2392 KB Output is correct
52 Correct 21 ms 2388 KB Output is correct
53 Correct 21 ms 2336 KB Output is correct
54 Correct 21 ms 2388 KB Output is correct
55 Correct 20 ms 2376 KB Output is correct
56 Correct 22 ms 2360 KB Output is correct
57 Correct 21 ms 2260 KB Output is correct
58 Correct 20 ms 2288 KB Output is correct
59 Correct 21 ms 2412 KB Output is correct
60 Correct 22 ms 2388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 7 ms 1620 KB Output is correct
15 Correct 14 ms 3084 KB Output is correct
16 Correct 22 ms 4180 KB Output is correct
17 Correct 24 ms 4556 KB Output is correct
18 Correct 19 ms 4052 KB Output is correct
19 Correct 20 ms 4056 KB Output is correct
20 Correct 21 ms 4376 KB Output is correct
21 Correct 23 ms 4152 KB Output is correct
22 Correct 22 ms 4052 KB Output is correct
23 Correct 21 ms 4100 KB Output is correct
24 Correct 20 ms 4224 KB Output is correct
25 Correct 20 ms 4188 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 2 ms 468 KB Output is correct
29 Correct 10 ms 1620 KB Output is correct
30 Correct 14 ms 2952 KB Output is correct
31 Correct 21 ms 4052 KB Output is correct
32 Correct 21 ms 4004 KB Output is correct
33 Correct 21 ms 4040 KB Output is correct
34 Correct 24 ms 4012 KB Output is correct
35 Correct 21 ms 4052 KB Output is correct
36 Correct 23 ms 4060 KB Output is correct
37 Correct 21 ms 4052 KB Output is correct
38 Correct 22 ms 4176 KB Output is correct
39 Correct 21 ms 4064 KB Output is correct
40 Correct 21 ms 4044 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 468 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 4 ms 596 KB Output is correct
48 Correct 3 ms 596 KB Output is correct
49 Correct 7 ms 872 KB Output is correct
50 Correct 14 ms 1636 KB Output is correct
51 Correct 22 ms 2372 KB Output is correct
52 Correct 23 ms 2464 KB Output is correct
53 Correct 21 ms 2412 KB Output is correct
54 Correct 21 ms 2432 KB Output is correct
55 Correct 21 ms 2388 KB Output is correct
56 Correct 21 ms 2360 KB Output is correct
57 Correct 21 ms 2328 KB Output is correct
58 Correct 22 ms 2512 KB Output is correct
59 Correct 22 ms 2332 KB Output is correct
60 Correct 22 ms 2620 KB Output is correct
61 Correct 21 ms 2392 KB Output is correct
62 Correct 21 ms 2388 KB Output is correct
63 Correct 21 ms 2336 KB Output is correct
64 Correct 21 ms 2388 KB Output is correct
65 Correct 20 ms 2376 KB Output is correct
66 Correct 22 ms 2360 KB Output is correct
67 Correct 21 ms 2260 KB Output is correct
68 Correct 20 ms 2288 KB Output is correct
69 Correct 21 ms 2412 KB Output is correct
70 Correct 22 ms 2388 KB Output is correct
71 Correct 4 ms 596 KB Output is correct
72 Correct 4 ms 596 KB Output is correct
73 Correct 4 ms 596 KB Output is correct
74 Correct 4 ms 596 KB Output is correct
75 Correct 4 ms 596 KB Output is correct
76 Correct 7 ms 716 KB Output is correct
77 Correct 7 ms 800 KB Output is correct
78 Correct 7 ms 784 KB Output is correct
79 Correct 7 ms 728 KB Output is correct
80 Correct 7 ms 728 KB Output is correct
81 Correct 15 ms 1132 KB Output is correct
82 Correct 14 ms 1108 KB Output is correct
83 Correct 18 ms 1144 KB Output is correct
84 Correct 14 ms 1108 KB Output is correct
85 Correct 13 ms 1236 KB Output is correct
86 Correct 18 ms 1256 KB Output is correct
87 Correct 16 ms 1236 KB Output is correct
88 Correct 15 ms 1236 KB Output is correct
89 Correct 15 ms 1156 KB Output is correct
90 Correct 16 ms 1236 KB Output is correct
91 Correct 23 ms 1876 KB Output is correct
92 Correct 23 ms 1880 KB Output is correct
93 Correct 24 ms 1848 KB Output is correct
94 Correct 23 ms 1896 KB Output is correct
95 Correct 23 ms 1868 KB Output is correct
96 Correct 26 ms 2300 KB Output is correct
97 Correct 29 ms 2208 KB Output is correct
98 Correct 29 ms 2256 KB Output is correct
99 Correct 30 ms 2252 KB Output is correct
100 Correct 28 ms 2316 KB Output is correct
101 Correct 28 ms 2220 KB Output is correct
102 Correct 26 ms 2272 KB Output is correct
103 Correct 27 ms 2244 KB Output is correct
104 Correct 27 ms 2252 KB Output is correct
105 Correct 27 ms 2248 KB Output is correct
106 Correct 26 ms 2516 KB Output is correct
107 Correct 27 ms 2516 KB Output is correct
108 Correct 27 ms 2440 KB Output is correct
109 Correct 27 ms 2508 KB Output is correct
110 Correct 28 ms 2504 KB Output is correct
111 Correct 27 ms 2416 KB Output is correct
112 Correct 27 ms 2508 KB Output is correct
113 Correct 28 ms 2456 KB Output is correct
114 Correct 28 ms 2440 KB Output is correct
115 Correct 27 ms 2516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 7 ms 1620 KB Output is correct
15 Correct 14 ms 3084 KB Output is correct
16 Correct 22 ms 4180 KB Output is correct
17 Correct 24 ms 4556 KB Output is correct
18 Correct 19 ms 4052 KB Output is correct
19 Correct 20 ms 4056 KB Output is correct
20 Correct 21 ms 4376 KB Output is correct
21 Correct 23 ms 4152 KB Output is correct
22 Correct 22 ms 4052 KB Output is correct
23 Correct 21 ms 4100 KB Output is correct
24 Correct 20 ms 4224 KB Output is correct
25 Correct 20 ms 4188 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 2 ms 468 KB Output is correct
29 Correct 10 ms 1620 KB Output is correct
30 Correct 14 ms 2952 KB Output is correct
31 Correct 21 ms 4052 KB Output is correct
32 Correct 21 ms 4004 KB Output is correct
33 Correct 21 ms 4040 KB Output is correct
34 Correct 24 ms 4012 KB Output is correct
35 Correct 21 ms 4052 KB Output is correct
36 Correct 23 ms 4060 KB Output is correct
37 Correct 21 ms 4052 KB Output is correct
38 Correct 22 ms 4176 KB Output is correct
39 Correct 21 ms 4064 KB Output is correct
40 Correct 21 ms 4044 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 468 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 4 ms 596 KB Output is correct
48 Correct 3 ms 596 KB Output is correct
49 Correct 7 ms 872 KB Output is correct
50 Correct 14 ms 1636 KB Output is correct
51 Correct 22 ms 2372 KB Output is correct
52 Correct 23 ms 2464 KB Output is correct
53 Correct 21 ms 2412 KB Output is correct
54 Correct 21 ms 2432 KB Output is correct
55 Correct 21 ms 2388 KB Output is correct
56 Correct 21 ms 2360 KB Output is correct
57 Correct 21 ms 2328 KB Output is correct
58 Correct 22 ms 2512 KB Output is correct
59 Correct 22 ms 2332 KB Output is correct
60 Correct 22 ms 2620 KB Output is correct
61 Correct 21 ms 2392 KB Output is correct
62 Correct 21 ms 2388 KB Output is correct
63 Correct 21 ms 2336 KB Output is correct
64 Correct 21 ms 2388 KB Output is correct
65 Correct 20 ms 2376 KB Output is correct
66 Correct 22 ms 2360 KB Output is correct
67 Correct 21 ms 2260 KB Output is correct
68 Correct 20 ms 2288 KB Output is correct
69 Correct 21 ms 2412 KB Output is correct
70 Correct 22 ms 2388 KB Output is correct
71 Correct 4 ms 596 KB Output is correct
72 Correct 4 ms 596 KB Output is correct
73 Correct 4 ms 596 KB Output is correct
74 Correct 4 ms 596 KB Output is correct
75 Correct 4 ms 596 KB Output is correct
76 Correct 7 ms 716 KB Output is correct
77 Correct 7 ms 800 KB Output is correct
78 Correct 7 ms 784 KB Output is correct
79 Correct 7 ms 728 KB Output is correct
80 Correct 7 ms 728 KB Output is correct
81 Correct 15 ms 1132 KB Output is correct
82 Correct 14 ms 1108 KB Output is correct
83 Correct 18 ms 1144 KB Output is correct
84 Correct 14 ms 1108 KB Output is correct
85 Correct 13 ms 1236 KB Output is correct
86 Correct 18 ms 1256 KB Output is correct
87 Correct 16 ms 1236 KB Output is correct
88 Correct 15 ms 1236 KB Output is correct
89 Correct 15 ms 1156 KB Output is correct
90 Correct 16 ms 1236 KB Output is correct
91 Correct 23 ms 1876 KB Output is correct
92 Correct 23 ms 1880 KB Output is correct
93 Correct 24 ms 1848 KB Output is correct
94 Correct 23 ms 1896 KB Output is correct
95 Correct 23 ms 1868 KB Output is correct
96 Correct 26 ms 2300 KB Output is correct
97 Correct 29 ms 2208 KB Output is correct
98 Correct 29 ms 2256 KB Output is correct
99 Correct 30 ms 2252 KB Output is correct
100 Correct 28 ms 2316 KB Output is correct
101 Correct 28 ms 2220 KB Output is correct
102 Correct 26 ms 2272 KB Output is correct
103 Correct 27 ms 2244 KB Output is correct
104 Correct 27 ms 2252 KB Output is correct
105 Correct 27 ms 2248 KB Output is correct
106 Correct 26 ms 2516 KB Output is correct
107 Correct 27 ms 2516 KB Output is correct
108 Correct 27 ms 2440 KB Output is correct
109 Correct 27 ms 2508 KB Output is correct
110 Correct 28 ms 2504 KB Output is correct
111 Correct 27 ms 2416 KB Output is correct
112 Correct 27 ms 2508 KB Output is correct
113 Correct 28 ms 2456 KB Output is correct
114 Correct 28 ms 2440 KB Output is correct
115 Correct 27 ms 2516 KB Output is correct
116 Correct 551 ms 1988 KB Output is correct
117 Correct 518 ms 1912 KB Output is correct
118 Correct 963 ms 2524 KB Output is correct
119 Correct 671 ms 2372 KB Output is correct
120 Correct 440 ms 2240 KB Output is correct
121 Correct 873 ms 2520 KB Output is correct
122 Correct 588 ms 2452 KB Output is correct
123 Correct 2110 ms 3432 KB Output is correct
124 Correct 892 ms 2968 KB Output is correct
125 Correct 733 ms 3072 KB Output is correct
126 Correct 5397 ms 5068 KB Output is correct
127 Correct 5388 ms 6768 KB Output is correct
128 Correct 5348 ms 6780 KB Output is correct
129 Correct 5336 ms 6764 KB Output is correct
130 Correct 5304 ms 6780 KB Output is correct
131 Correct 5108 ms 6544 KB Output is correct
132 Correct 5118 ms 6512 KB Output is correct
133 Correct 5327 ms 6628 KB Output is correct
134 Correct 5161 ms 6596 KB Output is correct
135 Correct 5172 ms 6464 KB Output is correct
136 Correct 5040 ms 6488 KB Output is correct
137 Correct 5156 ms 6572 KB Output is correct
138 Correct 5035 ms 6488 KB Output is correct
139 Correct 5134 ms 6548 KB Output is correct
140 Correct 5090 ms 6544 KB Output is correct
141 Correct 3716 ms 5864 KB Output is correct
142 Correct 3865 ms 5908 KB Output is correct
143 Correct 3828 ms 5956 KB Output is correct
144 Correct 3775 ms 5884 KB Output is correct
145 Correct 3790 ms 5956 KB Output is correct
146 Correct 1600 ms 5456 KB Output is correct
147 Correct 1554 ms 5448 KB Output is correct
148 Correct 1635 ms 5460 KB Output is correct
149 Correct 1564 ms 5444 KB Output is correct
150 Correct 1585 ms 5472 KB Output is correct
151 Correct 1429 ms 5452 KB Output is correct
152 Correct 1404 ms 5468 KB Output is correct
153 Correct 1423 ms 5444 KB Output is correct
154 Correct 1412 ms 5572 KB Output is correct
155 Correct 1407 ms 5440 KB Output is correct
156 Correct 3395 ms 6692 KB Output is correct
157 Correct 3417 ms 6712 KB Output is correct
158 Correct 3380 ms 6636 KB Output is correct
159 Correct 3287 ms 6632 KB Output is correct
160 Correct 3306 ms 6844 KB Output is correct
161 Correct 2745 ms 7080 KB Output is correct
162 Correct 2690 ms 6968 KB Output is correct
163 Correct 2770 ms 6980 KB Output is correct
164 Correct 2661 ms 7072 KB Output is correct
165 Correct 2694 ms 7024 KB Output is correct
166 Correct 4451 ms 7004 KB Output is correct
167 Correct 4531 ms 6956 KB Output is correct
168 Correct 4523 ms 6956 KB Output is correct
169 Correct 4546 ms 7076 KB Output is correct
170 Correct 4543 ms 6916 KB Output is correct
171 Correct 5039 ms 7424 KB Output is correct
172 Correct 4986 ms 7392 KB Output is correct
173 Correct 4987 ms 7428 KB Output is correct
174 Correct 4898 ms 7412 KB Output is correct
175 Correct 5080 ms 7448 KB Output is correct