Submission #900357

# Submission time Handle Problem Language Result Execution time Memory
900357 2024-01-08T07:50:20 Z gaga999 Aliens (IOI16_aliens) C++17
100 / 100
168 ms 7444 KB
#include <cstdio>
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <cstring>
#include <string.h>
#include <string>
#include <sstream>
#include <assert.h>
#include <climits>
#include <sstream>
#include <numeric>
#include <time.h>
#include <limits.h>
#include <list>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <complex>
#include <chrono>
#include <fstream>
#include <functional>
#include <unistd.h>
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx,avx2,bmi,bmi2,lzcnt,popcnt")
#define lowbit(x) ((x) & -(x))
#define ml(a, b) ((1ll * (a) * (b)) % M)
#define tml(a, b) (a) = ((1ll * (a) * (b)) % M)
#define ad(a, b) ((0ll + (a) + (b)) % M)
#define tad(a, b) (a) = ((0ll + (a) + (b)) % M)
#define mi(a, b) ((0ll + M + (a) - (b)) % M)
#define tmi(a, b) (a) = ((0ll + M + (a) - (b)) % M)
#define tmin(a, b) (a) = min((a), (b))
#define tmax(a, b) (a) = max((a), (b))
#define iter(a) (a).begin(), (a).end()
#define riter(a) (a).rbegin(), (a).rend()
#define init(a, b) memset((a), (b), sizeof(a))
#define cpy(a, b) memcpy((a), (b), sizeof(a))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define pb emplace_back
#define mpr make_pair
#define ls(i) ((i) << 1)
#define rs(i) ((i) << 1 | 1)
#define INF 0x3f3f3f3f
#define NIF 0xc0c0c0c0
#define eps 1e-9
#define F first
#define S second
#define AC cin.tie(0)->sync_with_stdio(0)
using namespace std;
typedef long long llt;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<llt, llt> pll;
typedef complex<double> cd;
// const int M = 998244353;

// random_device rm;
// mt19937 rg(rm());
// default_random_engine rg(rm());
// uniform_int_distribution<int> rd(INT_MIN, INT_MAX);
// uniform_real_distribution<double> rd(0, M_PI);

void db() { cerr << "\n"; }
template <class T, class... U>
void db(T a, U... b) { cerr << a << " ", db(b...); }

inline char gc()
{
    const static int SZ = 1 << 16;
    static char buf[SZ], *p1, *p2;
    if (p1 == p2 && (p2 = buf + fread(p1 = buf, 1, SZ, stdin), p1 == p2))
        return -1;
    return *p1++;
}
void rd() {}
template <typename T, typename... U>
void rd(T &x, U &...y)
{
    x = 0;
    bool f = 0;
    char c = gc();
    while (!isdigit(c))
        f ^= !(c ^ 45), c = gc();
    while (isdigit(c))
        x = (x << 1) + (x << 3) + (c ^ 48), c = gc();
    f && (x = -x), rd(y...);
}

template <typename T>
void prt(T x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        prt(x / 10);
    putchar((x % 10) ^ 48);
}

struct L
{
    llt a, b;
    inline llt operator()(llt x) { return a * x + b; }
};

inline llt itp(const L &l1, const L &l2)
{
    return (l1.b - l2.b) / (l2.a - l1.a);
}

inline bool ck(const L &l1, const L &l2, const L &l3)
{
    return itp(l2, l3) <= itp(l1, l2);
}

const int N = 1e5 + 5;
pll pt[N];
vector<pll> ar(1, mpr(-1, -1));
llt dp[N], vv;
int fr[N];

void slv(int n)
{
    deque<pair<L, int>> q;
    q.pb(mpr(L{-2 * ar[1].F, ar[1].F * ar[1].F}, 0));
    for (int i = 1; i <= n; i++)
    {
        while (q.size() > 1 && q[1].F(ar[i].S) <= q[0].F(ar[i].S))
            q.pop_front();
        fr[i] = q[0].S + 1, dp[i] = q[0].F(ar[i].S) + ar[i].S * ar[i].S + vv;
        if (i == n)
            return;
        L tp = {-2 * ar[i + 1].F, dp[i] + ar[i + 1].F * ar[i + 1].F};
        if (ar[i].S > ar[i + 1].F)
            tp.b -= (ar[i].S - ar[i + 1].F) * (ar[i].S - ar[i + 1].F);
        while (q.size() > 1 && ck(q[q.size() - 2].F, q.back().F, tp))
            q.pop_back();
        q.pb(mpr(tp, fr[i]));
    }
}

llt take_photos(int n, int m, int k, vector<int> xr, vector<int> yr)
{
    for (int i = 0; i < n; i++)
    {
        pt[i].F = xr[i], pt[i].S = yr[i];
        if (pt[i].F > pt[i].S)
            swap(pt[i].F, pt[i].S);
        pt[i].S++;
    }
    sort(pt, pt + n);
    for (int i = 0; i < n; i++)
    {
        if (pt[i].F == ar.back().F)
            tmax(ar.back().S, pt[i].S);
        else if (pt[i].S > ar.back().S)
            ar.pb(pt[i]);
    }
    n = ar.size() - 1, tmin(k, n);
    llt l = 0ll, r = 1000000000000ll;
    while (l < r - 1)
    {
        vv = (l + r) >> 1, slv(n);
        if (fr[n] == k)
            return dp[n] - vv * k;
        if (fr[n] > k)
            l = vv;
        else
            r = vv;
    }
    vv = l, slv(n);
    llt a1 = dp[n] - vv * fr[n], p1 = fr[n];
    vv = r, slv(n);
    llt a2 = dp[n] - vv * fr[n], p2 = fr[n];
    return a1 + (a1 - a2) / (p1 - p2) * (k - p1);
}

// signed main()
// {
//     int n, m, k;
//     rd(n, m, k);
//     vector<int> xr(n), yr(n);
//     for (int i = 0; i < n; i++)
//         rd(xr[i], yr[i]);
//     cerr << take_photos(n, m, k, xr, yr) << ' ';
// }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 4
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 4
4 Correct 1 ms 2396 KB Correct answer: answer = 12
5 Correct 1 ms 2392 KB Correct answer: answer = 52
6 Correct 1 ms 2500 KB Correct answer: answer = 210
7 Correct 1 ms 2396 KB Correct answer: answer = 88
8 Correct 0 ms 2492 KB Correct answer: answer = 7696
9 Correct 1 ms 2396 KB Correct answer: answer = 1
10 Correct 1 ms 2392 KB Correct answer: answer = 2374
11 Correct 1 ms 2396 KB Correct answer: answer = 9502
12 Correct 1 ms 2396 KB Correct answer: answer = 49
13 Correct 1 ms 2396 KB Correct answer: answer = 151
14 Correct 1 ms 2396 KB Correct answer: answer = 7550
15 Correct 1 ms 2396 KB Correct answer: answer = 7220
16 Correct 1 ms 2396 KB Correct answer: answer = 7550
17 Correct 0 ms 2396 KB Correct answer: answer = 10000
18 Correct 1 ms 2396 KB Correct answer: answer = 10000
19 Correct 1 ms 2396 KB Correct answer: answer = 624
20 Correct 1 ms 2392 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 1
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 1
4 Correct 1 ms 2392 KB Correct answer: answer = 5
5 Correct 4 ms 2408 KB Correct answer: answer = 41
6 Correct 1 ms 2396 KB Correct answer: answer = 71923
7 Correct 1 ms 2396 KB Correct answer: answer = 77137
8 Correct 1 ms 2396 KB Correct answer: answer = 764
9 Correct 1 ms 2396 KB Correct answer: answer = 250000
10 Correct 1 ms 2396 KB Correct answer: answer = 500
11 Correct 1 ms 2396 KB Correct answer: answer = 32
12 Correct 1 ms 2396 KB Correct answer: answer = 130050
13 Correct 1 ms 2392 KB Correct answer: answer = 5110
14 Correct 1 ms 2396 KB Correct answer: answer = 2626
15 Correct 1 ms 2396 KB Correct answer: answer = 796
16 Correct 1 ms 2396 KB Correct answer: answer = 7580
17 Correct 1 ms 2396 KB Correct answer: answer = 1904
18 Correct 1 ms 2396 KB Correct answer: answer = 996004
19 Correct 1 ms 2396 KB Correct answer: answer = 38817
20 Correct 1 ms 2396 KB Correct answer: answer = 4096
21 Correct 1 ms 2396 KB Correct answer: answer = 1
22 Correct 1 ms 2392 KB Correct answer: answer = 1
23 Correct 1 ms 2396 KB Correct answer: answer = 2040
24 Correct 1 ms 2480 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 4
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 4
4 Correct 1 ms 2396 KB Correct answer: answer = 12
5 Correct 1 ms 2392 KB Correct answer: answer = 52
6 Correct 1 ms 2500 KB Correct answer: answer = 210
7 Correct 1 ms 2396 KB Correct answer: answer = 88
8 Correct 0 ms 2492 KB Correct answer: answer = 7696
9 Correct 1 ms 2396 KB Correct answer: answer = 1
10 Correct 1 ms 2392 KB Correct answer: answer = 2374
11 Correct 1 ms 2396 KB Correct answer: answer = 9502
12 Correct 1 ms 2396 KB Correct answer: answer = 49
13 Correct 1 ms 2396 KB Correct answer: answer = 151
14 Correct 1 ms 2396 KB Correct answer: answer = 7550
15 Correct 1 ms 2396 KB Correct answer: answer = 7220
16 Correct 1 ms 2396 KB Correct answer: answer = 7550
17 Correct 0 ms 2396 KB Correct answer: answer = 10000
18 Correct 1 ms 2396 KB Correct answer: answer = 10000
19 Correct 1 ms 2396 KB Correct answer: answer = 624
20 Correct 1 ms 2392 KB Correct answer: answer = 10000
21 Correct 1 ms 2396 KB Correct answer: answer = 1
22 Correct 1 ms 2396 KB Correct answer: answer = 4
23 Correct 1 ms 2396 KB Correct answer: answer = 1
24 Correct 1 ms 2392 KB Correct answer: answer = 5
25 Correct 4 ms 2408 KB Correct answer: answer = 41
26 Correct 1 ms 2396 KB Correct answer: answer = 71923
27 Correct 1 ms 2396 KB Correct answer: answer = 77137
28 Correct 1 ms 2396 KB Correct answer: answer = 764
29 Correct 1 ms 2396 KB Correct answer: answer = 250000
30 Correct 1 ms 2396 KB Correct answer: answer = 500
31 Correct 1 ms 2396 KB Correct answer: answer = 32
32 Correct 1 ms 2396 KB Correct answer: answer = 130050
33 Correct 1 ms 2392 KB Correct answer: answer = 5110
34 Correct 1 ms 2396 KB Correct answer: answer = 2626
35 Correct 1 ms 2396 KB Correct answer: answer = 796
36 Correct 1 ms 2396 KB Correct answer: answer = 7580
37 Correct 1 ms 2396 KB Correct answer: answer = 1904
38 Correct 1 ms 2396 KB Correct answer: answer = 996004
39 Correct 1 ms 2396 KB Correct answer: answer = 38817
40 Correct 1 ms 2396 KB Correct answer: answer = 4096
41 Correct 1 ms 2396 KB Correct answer: answer = 1
42 Correct 1 ms 2392 KB Correct answer: answer = 1
43 Correct 1 ms 2396 KB Correct answer: answer = 2040
44 Correct 1 ms 2480 KB Correct answer: answer = 2
45 Correct 1 ms 2392 KB Correct answer: answer = 4
46 Correct 1 ms 2392 KB Correct answer: answer = 9
47 Correct 1 ms 2392 KB Correct answer: answer = 9
48 Correct 1 ms 2392 KB Correct answer: answer = 21
49 Correct 1 ms 2396 KB Correct answer: answer = 71
50 Correct 0 ms 2396 KB Correct answer: answer = 77
51 Correct 1 ms 2396 KB Correct answer: answer = 400
52 Correct 1 ms 2396 KB Correct answer: answer = 996004
53 Correct 1 ms 2396 KB Correct answer: answer = 997310
54 Correct 1 ms 2396 KB Correct answer: answer = 990781
55 Correct 1 ms 2396 KB Correct answer: answer = 996545
56 Correct 1 ms 2396 KB Correct answer: answer = 484
57 Correct 1 ms 2396 KB Correct answer: answer = 484
58 Correct 1 ms 2396 KB Correct answer: answer = 63501
59 Correct 1 ms 2396 KB Correct answer: answer = 323501
60 Correct 1 ms 2396 KB Correct answer: answer = 752500
61 Correct 1 ms 2396 KB Correct answer: answer = 761480
62 Correct 1 ms 2396 KB Correct answer: answer = 758932
63 Correct 1 ms 2396 KB Correct answer: answer = 1000000
64 Correct 1 ms 2396 KB Correct answer: answer = 750500
65 Correct 1 ms 2396 KB Correct answer: answer = 1000000
66 Correct 1 ms 2396 KB Correct answer: answer = 250000
67 Correct 1 ms 2396 KB Correct answer: answer = 250000
68 Correct 1 ms 2396 KB Correct answer: answer = 1000000
69 Correct 1 ms 2392 KB Correct answer: answer = 994009
70 Correct 1 ms 2396 KB Correct answer: answer = 59315
71 Correct 1 ms 2396 KB Correct answer: answer = 25454
72 Correct 1 ms 2392 KB Correct answer: answer = 1504
73 Correct 1 ms 2396 KB Correct answer: answer = 37486
74 Correct 1 ms 2396 KB Correct answer: answer = 4284
75 Correct 1 ms 2396 KB Correct answer: answer = 158008
76 Correct 1 ms 2396 KB Correct answer: answer = 51860
77 Correct 1 ms 2392 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 4
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 4
4 Correct 1 ms 2396 KB Correct answer: answer = 12
5 Correct 1 ms 2392 KB Correct answer: answer = 52
6 Correct 1 ms 2500 KB Correct answer: answer = 210
7 Correct 1 ms 2396 KB Correct answer: answer = 88
8 Correct 0 ms 2492 KB Correct answer: answer = 7696
9 Correct 1 ms 2396 KB Correct answer: answer = 1
10 Correct 1 ms 2392 KB Correct answer: answer = 2374
11 Correct 1 ms 2396 KB Correct answer: answer = 9502
12 Correct 1 ms 2396 KB Correct answer: answer = 49
13 Correct 1 ms 2396 KB Correct answer: answer = 151
14 Correct 1 ms 2396 KB Correct answer: answer = 7550
15 Correct 1 ms 2396 KB Correct answer: answer = 7220
16 Correct 1 ms 2396 KB Correct answer: answer = 7550
17 Correct 0 ms 2396 KB Correct answer: answer = 10000
18 Correct 1 ms 2396 KB Correct answer: answer = 10000
19 Correct 1 ms 2396 KB Correct answer: answer = 624
20 Correct 1 ms 2392 KB Correct answer: answer = 10000
21 Correct 1 ms 2396 KB Correct answer: answer = 1
22 Correct 1 ms 2396 KB Correct answer: answer = 4
23 Correct 1 ms 2396 KB Correct answer: answer = 1
24 Correct 1 ms 2392 KB Correct answer: answer = 5
25 Correct 4 ms 2408 KB Correct answer: answer = 41
26 Correct 1 ms 2396 KB Correct answer: answer = 71923
27 Correct 1 ms 2396 KB Correct answer: answer = 77137
28 Correct 1 ms 2396 KB Correct answer: answer = 764
29 Correct 1 ms 2396 KB Correct answer: answer = 250000
30 Correct 1 ms 2396 KB Correct answer: answer = 500
31 Correct 1 ms 2396 KB Correct answer: answer = 32
32 Correct 1 ms 2396 KB Correct answer: answer = 130050
33 Correct 1 ms 2392 KB Correct answer: answer = 5110
34 Correct 1 ms 2396 KB Correct answer: answer = 2626
35 Correct 1 ms 2396 KB Correct answer: answer = 796
36 Correct 1 ms 2396 KB Correct answer: answer = 7580
37 Correct 1 ms 2396 KB Correct answer: answer = 1904
38 Correct 1 ms 2396 KB Correct answer: answer = 996004
39 Correct 1 ms 2396 KB Correct answer: answer = 38817
40 Correct 1 ms 2396 KB Correct answer: answer = 4096
41 Correct 1 ms 2396 KB Correct answer: answer = 1
42 Correct 1 ms 2392 KB Correct answer: answer = 1
43 Correct 1 ms 2396 KB Correct answer: answer = 2040
44 Correct 1 ms 2480 KB Correct answer: answer = 2
45 Correct 1 ms 2392 KB Correct answer: answer = 4
46 Correct 1 ms 2392 KB Correct answer: answer = 9
47 Correct 1 ms 2392 KB Correct answer: answer = 9
48 Correct 1 ms 2392 KB Correct answer: answer = 21
49 Correct 1 ms 2396 KB Correct answer: answer = 71
50 Correct 0 ms 2396 KB Correct answer: answer = 77
51 Correct 1 ms 2396 KB Correct answer: answer = 400
52 Correct 1 ms 2396 KB Correct answer: answer = 996004
53 Correct 1 ms 2396 KB Correct answer: answer = 997310
54 Correct 1 ms 2396 KB Correct answer: answer = 990781
55 Correct 1 ms 2396 KB Correct answer: answer = 996545
56 Correct 1 ms 2396 KB Correct answer: answer = 484
57 Correct 1 ms 2396 KB Correct answer: answer = 484
58 Correct 1 ms 2396 KB Correct answer: answer = 63501
59 Correct 1 ms 2396 KB Correct answer: answer = 323501
60 Correct 1 ms 2396 KB Correct answer: answer = 752500
61 Correct 1 ms 2396 KB Correct answer: answer = 761480
62 Correct 1 ms 2396 KB Correct answer: answer = 758932
63 Correct 1 ms 2396 KB Correct answer: answer = 1000000
64 Correct 1 ms 2396 KB Correct answer: answer = 750500
65 Correct 1 ms 2396 KB Correct answer: answer = 1000000
66 Correct 1 ms 2396 KB Correct answer: answer = 250000
67 Correct 1 ms 2396 KB Correct answer: answer = 250000
68 Correct 1 ms 2396 KB Correct answer: answer = 1000000
69 Correct 1 ms 2392 KB Correct answer: answer = 994009
70 Correct 1 ms 2396 KB Correct answer: answer = 59315
71 Correct 1 ms 2396 KB Correct answer: answer = 25454
72 Correct 1 ms 2392 KB Correct answer: answer = 1504
73 Correct 1 ms 2396 KB Correct answer: answer = 37486
74 Correct 1 ms 2396 KB Correct answer: answer = 4284
75 Correct 1 ms 2396 KB Correct answer: answer = 158008
76 Correct 1 ms 2396 KB Correct answer: answer = 51860
77 Correct 1 ms 2392 KB Correct answer: answer = 12985
78 Correct 2 ms 2396 KB Correct answer: answer = 997864126212
79 Correct 2 ms 2396 KB Correct answer: answer = 998608411647
80 Correct 2 ms 2396 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2652 KB Correct answer: answer = 10125000
82 Correct 4 ms 2652 KB Correct answer: answer = 2291668
83 Correct 3 ms 2652 KB Correct answer: answer = 42388
84 Correct 3 ms 2392 KB Correct answer: answer = 10318
85 Correct 3 ms 2652 KB Correct answer: answer = 3416
86 Correct 2 ms 2652 KB Correct answer: answer = 331708193881
87 Correct 5 ms 2652 KB Correct answer: answer = 2861193756
88 Correct 8 ms 2652 KB Correct answer: answer = 114646930
89 Correct 5 ms 2652 KB Correct answer: answer = 9280921
90 Correct 6 ms 2652 KB Correct answer: answer = 999984053400
91 Correct 7 ms 2904 KB Correct answer: answer = 750935949134
92 Correct 1 ms 2396 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 2396 KB Correct answer: answer = 998762383161
94 Correct 5 ms 2760 KB Correct answer: answer = 23017412908
95 Correct 2 ms 2512 KB Correct answer: answer = 728143410622
96 Correct 1 ms 2536 KB Correct answer: answer = 2
97 Correct 4 ms 2508 KB Correct answer: answer = 1824916
98 Correct 7 ms 2748 KB Correct answer: answer = 10680029
99 Correct 5 ms 2648 KB Correct answer: answer = 18351700
100 Correct 2 ms 2652 KB Correct answer: answer = 16040026
101 Correct 2 ms 2392 KB Correct answer: answer = 253968628325
102 Correct 4 ms 2396 KB Correct answer: answer = 10267
103 Correct 7 ms 2572 KB Correct answer: answer = 2582408
104 Correct 1 ms 2396 KB Correct answer: answer = 78024964781
105 Correct 2 ms 2648 KB Correct answer: answer = 9866346457
106 Correct 2 ms 2396 KB Correct answer: answer = 3327720949
107 Correct 3 ms 2396 KB Correct answer: answer = 86064128360
108 Correct 2 ms 2396 KB Correct answer: answer = 12698259150
109 Correct 5 ms 2652 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 4
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 4
4 Correct 1 ms 2396 KB Correct answer: answer = 12
5 Correct 1 ms 2392 KB Correct answer: answer = 52
6 Correct 1 ms 2500 KB Correct answer: answer = 210
7 Correct 1 ms 2396 KB Correct answer: answer = 88
8 Correct 0 ms 2492 KB Correct answer: answer = 7696
9 Correct 1 ms 2396 KB Correct answer: answer = 1
10 Correct 1 ms 2392 KB Correct answer: answer = 2374
11 Correct 1 ms 2396 KB Correct answer: answer = 9502
12 Correct 1 ms 2396 KB Correct answer: answer = 49
13 Correct 1 ms 2396 KB Correct answer: answer = 151
14 Correct 1 ms 2396 KB Correct answer: answer = 7550
15 Correct 1 ms 2396 KB Correct answer: answer = 7220
16 Correct 1 ms 2396 KB Correct answer: answer = 7550
17 Correct 0 ms 2396 KB Correct answer: answer = 10000
18 Correct 1 ms 2396 KB Correct answer: answer = 10000
19 Correct 1 ms 2396 KB Correct answer: answer = 624
20 Correct 1 ms 2392 KB Correct answer: answer = 10000
21 Correct 1 ms 2396 KB Correct answer: answer = 1
22 Correct 1 ms 2396 KB Correct answer: answer = 4
23 Correct 1 ms 2396 KB Correct answer: answer = 1
24 Correct 1 ms 2392 KB Correct answer: answer = 5
25 Correct 4 ms 2408 KB Correct answer: answer = 41
26 Correct 1 ms 2396 KB Correct answer: answer = 71923
27 Correct 1 ms 2396 KB Correct answer: answer = 77137
28 Correct 1 ms 2396 KB Correct answer: answer = 764
29 Correct 1 ms 2396 KB Correct answer: answer = 250000
30 Correct 1 ms 2396 KB Correct answer: answer = 500
31 Correct 1 ms 2396 KB Correct answer: answer = 32
32 Correct 1 ms 2396 KB Correct answer: answer = 130050
33 Correct 1 ms 2392 KB Correct answer: answer = 5110
34 Correct 1 ms 2396 KB Correct answer: answer = 2626
35 Correct 1 ms 2396 KB Correct answer: answer = 796
36 Correct 1 ms 2396 KB Correct answer: answer = 7580
37 Correct 1 ms 2396 KB Correct answer: answer = 1904
38 Correct 1 ms 2396 KB Correct answer: answer = 996004
39 Correct 1 ms 2396 KB Correct answer: answer = 38817
40 Correct 1 ms 2396 KB Correct answer: answer = 4096
41 Correct 1 ms 2396 KB Correct answer: answer = 1
42 Correct 1 ms 2392 KB Correct answer: answer = 1
43 Correct 1 ms 2396 KB Correct answer: answer = 2040
44 Correct 1 ms 2480 KB Correct answer: answer = 2
45 Correct 1 ms 2392 KB Correct answer: answer = 4
46 Correct 1 ms 2392 KB Correct answer: answer = 9
47 Correct 1 ms 2392 KB Correct answer: answer = 9
48 Correct 1 ms 2392 KB Correct answer: answer = 21
49 Correct 1 ms 2396 KB Correct answer: answer = 71
50 Correct 0 ms 2396 KB Correct answer: answer = 77
51 Correct 1 ms 2396 KB Correct answer: answer = 400
52 Correct 1 ms 2396 KB Correct answer: answer = 996004
53 Correct 1 ms 2396 KB Correct answer: answer = 997310
54 Correct 1 ms 2396 KB Correct answer: answer = 990781
55 Correct 1 ms 2396 KB Correct answer: answer = 996545
56 Correct 1 ms 2396 KB Correct answer: answer = 484
57 Correct 1 ms 2396 KB Correct answer: answer = 484
58 Correct 1 ms 2396 KB Correct answer: answer = 63501
59 Correct 1 ms 2396 KB Correct answer: answer = 323501
60 Correct 1 ms 2396 KB Correct answer: answer = 752500
61 Correct 1 ms 2396 KB Correct answer: answer = 761480
62 Correct 1 ms 2396 KB Correct answer: answer = 758932
63 Correct 1 ms 2396 KB Correct answer: answer = 1000000
64 Correct 1 ms 2396 KB Correct answer: answer = 750500
65 Correct 1 ms 2396 KB Correct answer: answer = 1000000
66 Correct 1 ms 2396 KB Correct answer: answer = 250000
67 Correct 1 ms 2396 KB Correct answer: answer = 250000
68 Correct 1 ms 2396 KB Correct answer: answer = 1000000
69 Correct 1 ms 2392 KB Correct answer: answer = 994009
70 Correct 1 ms 2396 KB Correct answer: answer = 59315
71 Correct 1 ms 2396 KB Correct answer: answer = 25454
72 Correct 1 ms 2392 KB Correct answer: answer = 1504
73 Correct 1 ms 2396 KB Correct answer: answer = 37486
74 Correct 1 ms 2396 KB Correct answer: answer = 4284
75 Correct 1 ms 2396 KB Correct answer: answer = 158008
76 Correct 1 ms 2396 KB Correct answer: answer = 51860
77 Correct 1 ms 2392 KB Correct answer: answer = 12985
78 Correct 2 ms 2396 KB Correct answer: answer = 997864126212
79 Correct 2 ms 2396 KB Correct answer: answer = 998608411647
80 Correct 2 ms 2396 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2652 KB Correct answer: answer = 10125000
82 Correct 4 ms 2652 KB Correct answer: answer = 2291668
83 Correct 3 ms 2652 KB Correct answer: answer = 42388
84 Correct 3 ms 2392 KB Correct answer: answer = 10318
85 Correct 3 ms 2652 KB Correct answer: answer = 3416
86 Correct 2 ms 2652 KB Correct answer: answer = 331708193881
87 Correct 5 ms 2652 KB Correct answer: answer = 2861193756
88 Correct 8 ms 2652 KB Correct answer: answer = 114646930
89 Correct 5 ms 2652 KB Correct answer: answer = 9280921
90 Correct 6 ms 2652 KB Correct answer: answer = 999984053400
91 Correct 7 ms 2904 KB Correct answer: answer = 750935949134
92 Correct 1 ms 2396 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 2396 KB Correct answer: answer = 998762383161
94 Correct 5 ms 2760 KB Correct answer: answer = 23017412908
95 Correct 2 ms 2512 KB Correct answer: answer = 728143410622
96 Correct 1 ms 2536 KB Correct answer: answer = 2
97 Correct 4 ms 2508 KB Correct answer: answer = 1824916
98 Correct 7 ms 2748 KB Correct answer: answer = 10680029
99 Correct 5 ms 2648 KB Correct answer: answer = 18351700
100 Correct 2 ms 2652 KB Correct answer: answer = 16040026
101 Correct 2 ms 2392 KB Correct answer: answer = 253968628325
102 Correct 4 ms 2396 KB Correct answer: answer = 10267
103 Correct 7 ms 2572 KB Correct answer: answer = 2582408
104 Correct 1 ms 2396 KB Correct answer: answer = 78024964781
105 Correct 2 ms 2648 KB Correct answer: answer = 9866346457
106 Correct 2 ms 2396 KB Correct answer: answer = 3327720949
107 Correct 3 ms 2396 KB Correct answer: answer = 86064128360
108 Correct 2 ms 2396 KB Correct answer: answer = 12698259150
109 Correct 5 ms 2652 KB Correct answer: answer = 1185259288
110 Correct 13 ms 3676 KB Correct answer: answer = 999889968863
111 Correct 13 ms 3676 KB Correct answer: answer = 999861384931
112 Correct 12 ms 3672 KB Correct answer: answer = 999811809929
113 Correct 12 ms 3780 KB Correct answer: answer = 999869756441
114 Correct 30 ms 5368 KB Correct answer: answer = 1700000000
115 Correct 41 ms 5176 KB Correct answer: answer = 131666670
116 Correct 9 ms 3544 KB Correct answer: answer = 89478486
117 Correct 16 ms 3544 KB Correct answer: answer = 4971040
118 Correct 17 ms 3540 KB Correct answer: answer = 2711494
119 Correct 58 ms 5068 KB Correct answer: answer = 25252530
120 Correct 39 ms 5100 KB Correct answer: answer = 62500000
121 Correct 18 ms 4820 KB Correct answer: answer = 333175097780
122 Correct 41 ms 4856 KB Correct answer: answer = 33121180179
123 Correct 63 ms 4820 KB Correct answer: answer = 9802314015
124 Correct 45 ms 5288 KB Correct answer: answer = 32567551
125 Correct 71 ms 5176 KB Correct answer: answer = 997525000000
126 Correct 64 ms 4816 KB Correct answer: answer = 752723538884
127 Correct 8 ms 3164 KB Correct answer: answer = 1000000000000
128 Correct 16 ms 3164 KB Correct answer: answer = 999978000121
129 Correct 11 ms 3284 KB Correct answer: answer = 745986144735
130 Correct 7 ms 3160 KB Correct answer: answer = 2
131 Correct 34 ms 4560 KB Correct answer: answer = 277966670
132 Correct 13 ms 4308 KB Correct answer: answer = 2500900082
133 Correct 19 ms 3420 KB Correct answer: answer = 301248349636
134 Correct 38 ms 3288 KB Correct answer: answer = 14118891
135 Correct 12 ms 3164 KB Correct answer: answer = 14384977265
136 Correct 17 ms 3160 KB Correct answer: answer = 3681368330
137 Correct 12 ms 3416 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Correct answer: answer = 4
2 Correct 1 ms 2396 KB Correct answer: answer = 4
3 Correct 1 ms 2396 KB Correct answer: answer = 4
4 Correct 1 ms 2396 KB Correct answer: answer = 12
5 Correct 1 ms 2392 KB Correct answer: answer = 52
6 Correct 1 ms 2500 KB Correct answer: answer = 210
7 Correct 1 ms 2396 KB Correct answer: answer = 88
8 Correct 0 ms 2492 KB Correct answer: answer = 7696
9 Correct 1 ms 2396 KB Correct answer: answer = 1
10 Correct 1 ms 2392 KB Correct answer: answer = 2374
11 Correct 1 ms 2396 KB Correct answer: answer = 9502
12 Correct 1 ms 2396 KB Correct answer: answer = 49
13 Correct 1 ms 2396 KB Correct answer: answer = 151
14 Correct 1 ms 2396 KB Correct answer: answer = 7550
15 Correct 1 ms 2396 KB Correct answer: answer = 7220
16 Correct 1 ms 2396 KB Correct answer: answer = 7550
17 Correct 0 ms 2396 KB Correct answer: answer = 10000
18 Correct 1 ms 2396 KB Correct answer: answer = 10000
19 Correct 1 ms 2396 KB Correct answer: answer = 624
20 Correct 1 ms 2392 KB Correct answer: answer = 10000
21 Correct 1 ms 2396 KB Correct answer: answer = 1
22 Correct 1 ms 2396 KB Correct answer: answer = 4
23 Correct 1 ms 2396 KB Correct answer: answer = 1
24 Correct 1 ms 2392 KB Correct answer: answer = 5
25 Correct 4 ms 2408 KB Correct answer: answer = 41
26 Correct 1 ms 2396 KB Correct answer: answer = 71923
27 Correct 1 ms 2396 KB Correct answer: answer = 77137
28 Correct 1 ms 2396 KB Correct answer: answer = 764
29 Correct 1 ms 2396 KB Correct answer: answer = 250000
30 Correct 1 ms 2396 KB Correct answer: answer = 500
31 Correct 1 ms 2396 KB Correct answer: answer = 32
32 Correct 1 ms 2396 KB Correct answer: answer = 130050
33 Correct 1 ms 2392 KB Correct answer: answer = 5110
34 Correct 1 ms 2396 KB Correct answer: answer = 2626
35 Correct 1 ms 2396 KB Correct answer: answer = 796
36 Correct 1 ms 2396 KB Correct answer: answer = 7580
37 Correct 1 ms 2396 KB Correct answer: answer = 1904
38 Correct 1 ms 2396 KB Correct answer: answer = 996004
39 Correct 1 ms 2396 KB Correct answer: answer = 38817
40 Correct 1 ms 2396 KB Correct answer: answer = 4096
41 Correct 1 ms 2396 KB Correct answer: answer = 1
42 Correct 1 ms 2392 KB Correct answer: answer = 1
43 Correct 1 ms 2396 KB Correct answer: answer = 2040
44 Correct 1 ms 2480 KB Correct answer: answer = 2
45 Correct 1 ms 2392 KB Correct answer: answer = 4
46 Correct 1 ms 2392 KB Correct answer: answer = 9
47 Correct 1 ms 2392 KB Correct answer: answer = 9
48 Correct 1 ms 2392 KB Correct answer: answer = 21
49 Correct 1 ms 2396 KB Correct answer: answer = 71
50 Correct 0 ms 2396 KB Correct answer: answer = 77
51 Correct 1 ms 2396 KB Correct answer: answer = 400
52 Correct 1 ms 2396 KB Correct answer: answer = 996004
53 Correct 1 ms 2396 KB Correct answer: answer = 997310
54 Correct 1 ms 2396 KB Correct answer: answer = 990781
55 Correct 1 ms 2396 KB Correct answer: answer = 996545
56 Correct 1 ms 2396 KB Correct answer: answer = 484
57 Correct 1 ms 2396 KB Correct answer: answer = 484
58 Correct 1 ms 2396 KB Correct answer: answer = 63501
59 Correct 1 ms 2396 KB Correct answer: answer = 323501
60 Correct 1 ms 2396 KB Correct answer: answer = 752500
61 Correct 1 ms 2396 KB Correct answer: answer = 761480
62 Correct 1 ms 2396 KB Correct answer: answer = 758932
63 Correct 1 ms 2396 KB Correct answer: answer = 1000000
64 Correct 1 ms 2396 KB Correct answer: answer = 750500
65 Correct 1 ms 2396 KB Correct answer: answer = 1000000
66 Correct 1 ms 2396 KB Correct answer: answer = 250000
67 Correct 1 ms 2396 KB Correct answer: answer = 250000
68 Correct 1 ms 2396 KB Correct answer: answer = 1000000
69 Correct 1 ms 2392 KB Correct answer: answer = 994009
70 Correct 1 ms 2396 KB Correct answer: answer = 59315
71 Correct 1 ms 2396 KB Correct answer: answer = 25454
72 Correct 1 ms 2392 KB Correct answer: answer = 1504
73 Correct 1 ms 2396 KB Correct answer: answer = 37486
74 Correct 1 ms 2396 KB Correct answer: answer = 4284
75 Correct 1 ms 2396 KB Correct answer: answer = 158008
76 Correct 1 ms 2396 KB Correct answer: answer = 51860
77 Correct 1 ms 2392 KB Correct answer: answer = 12985
78 Correct 2 ms 2396 KB Correct answer: answer = 997864126212
79 Correct 2 ms 2396 KB Correct answer: answer = 998608411647
80 Correct 2 ms 2396 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2652 KB Correct answer: answer = 10125000
82 Correct 4 ms 2652 KB Correct answer: answer = 2291668
83 Correct 3 ms 2652 KB Correct answer: answer = 42388
84 Correct 3 ms 2392 KB Correct answer: answer = 10318
85 Correct 3 ms 2652 KB Correct answer: answer = 3416
86 Correct 2 ms 2652 KB Correct answer: answer = 331708193881
87 Correct 5 ms 2652 KB Correct answer: answer = 2861193756
88 Correct 8 ms 2652 KB Correct answer: answer = 114646930
89 Correct 5 ms 2652 KB Correct answer: answer = 9280921
90 Correct 6 ms 2652 KB Correct answer: answer = 999984053400
91 Correct 7 ms 2904 KB Correct answer: answer = 750935949134
92 Correct 1 ms 2396 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 2396 KB Correct answer: answer = 998762383161
94 Correct 5 ms 2760 KB Correct answer: answer = 23017412908
95 Correct 2 ms 2512 KB Correct answer: answer = 728143410622
96 Correct 1 ms 2536 KB Correct answer: answer = 2
97 Correct 4 ms 2508 KB Correct answer: answer = 1824916
98 Correct 7 ms 2748 KB Correct answer: answer = 10680029
99 Correct 5 ms 2648 KB Correct answer: answer = 18351700
100 Correct 2 ms 2652 KB Correct answer: answer = 16040026
101 Correct 2 ms 2392 KB Correct answer: answer = 253968628325
102 Correct 4 ms 2396 KB Correct answer: answer = 10267
103 Correct 7 ms 2572 KB Correct answer: answer = 2582408
104 Correct 1 ms 2396 KB Correct answer: answer = 78024964781
105 Correct 2 ms 2648 KB Correct answer: answer = 9866346457
106 Correct 2 ms 2396 KB Correct answer: answer = 3327720949
107 Correct 3 ms 2396 KB Correct answer: answer = 86064128360
108 Correct 2 ms 2396 KB Correct answer: answer = 12698259150
109 Correct 5 ms 2652 KB Correct answer: answer = 1185259288
110 Correct 13 ms 3676 KB Correct answer: answer = 999889968863
111 Correct 13 ms 3676 KB Correct answer: answer = 999861384931
112 Correct 12 ms 3672 KB Correct answer: answer = 999811809929
113 Correct 12 ms 3780 KB Correct answer: answer = 999869756441
114 Correct 30 ms 5368 KB Correct answer: answer = 1700000000
115 Correct 41 ms 5176 KB Correct answer: answer = 131666670
116 Correct 9 ms 3544 KB Correct answer: answer = 89478486
117 Correct 16 ms 3544 KB Correct answer: answer = 4971040
118 Correct 17 ms 3540 KB Correct answer: answer = 2711494
119 Correct 58 ms 5068 KB Correct answer: answer = 25252530
120 Correct 39 ms 5100 KB Correct answer: answer = 62500000
121 Correct 18 ms 4820 KB Correct answer: answer = 333175097780
122 Correct 41 ms 4856 KB Correct answer: answer = 33121180179
123 Correct 63 ms 4820 KB Correct answer: answer = 9802314015
124 Correct 45 ms 5288 KB Correct answer: answer = 32567551
125 Correct 71 ms 5176 KB Correct answer: answer = 997525000000
126 Correct 64 ms 4816 KB Correct answer: answer = 752723538884
127 Correct 8 ms 3164 KB Correct answer: answer = 1000000000000
128 Correct 16 ms 3164 KB Correct answer: answer = 999978000121
129 Correct 11 ms 3284 KB Correct answer: answer = 745986144735
130 Correct 7 ms 3160 KB Correct answer: answer = 2
131 Correct 34 ms 4560 KB Correct answer: answer = 277966670
132 Correct 13 ms 4308 KB Correct answer: answer = 2500900082
133 Correct 19 ms 3420 KB Correct answer: answer = 301248349636
134 Correct 38 ms 3288 KB Correct answer: answer = 14118891
135 Correct 12 ms 3164 KB Correct answer: answer = 14384977265
136 Correct 17 ms 3160 KB Correct answer: answer = 3681368330
137 Correct 12 ms 3416 KB Correct answer: answer = 2720316816
138 Correct 30 ms 4444 KB Correct answer: answer = 999976000144
139 Correct 28 ms 4444 KB Correct answer: answer = 999856102410
140 Correct 28 ms 4572 KB Correct answer: answer = 999958401531
141 Correct 26 ms 4444 KB Correct answer: answer = 999769649944
142 Correct 23 ms 4440 KB Correct answer: answer = 999874525918
143 Correct 44 ms 7364 KB Correct answer: answer = 6050000000
144 Correct 58 ms 7396 KB Correct answer: answer = 1112500000
145 Correct 13 ms 5580 KB Correct answer: answer = 4294967296
146 Correct 58 ms 5584 KB Correct answer: answer = 87652406
147 Correct 66 ms 5584 KB Correct answer: answer = 6297664
148 Correct 79 ms 5580 KB Correct answer: answer = 196612
149 Correct 115 ms 7360 KB Correct answer: answer = 15015100
150 Correct 97 ms 7392 KB Correct answer: answer = 25000000
151 Correct 35 ms 6608 KB Correct answer: answer = 333230209550
152 Correct 139 ms 6600 KB Correct answer: answer = 917123769
153 Correct 168 ms 6596 KB Correct answer: answer = 95162
154 Correct 79 ms 7396 KB Correct answer: answer = 382616191
155 Correct 112 ms 7444 KB Correct answer: answer = 990033333400
156 Correct 131 ms 7396 KB Correct answer: answer = 990000100000
157 Correct 160 ms 6600 KB Correct answer: answer = 749998188180
158 Correct 16 ms 4440 KB Correct answer: answer = 1000000000000
159 Correct 25 ms 4696 KB Correct answer: answer = 999988000036
160 Correct 22 ms 4444 KB Correct answer: answer = 744929274393
161 Correct 13 ms 4444 KB Correct answer: answer = 2
162 Correct 130 ms 7212 KB Correct answer: answer = 1300024
163 Correct 43 ms 7248 KB Correct answer: answer = 5000700010
164 Correct 26 ms 5364 KB Correct answer: answer = 354997100800
165 Correct 78 ms 4488 KB Correct answer: answer = 257000
166 Correct 78 ms 5076 KB Correct answer: answer = 3765323
167 Correct 71 ms 4816 KB Correct answer: answer = 1525903
168 Correct 23 ms 4444 KB Correct answer: answer = 67618137730
169 Correct 23 ms 4444 KB Correct answer: answer = 12656680171
170 Correct 25 ms 4568 KB Correct answer: answer = 579831736
171 Correct 67 ms 5200 KB Correct answer: answer = 23605611
172 Correct 27 ms 4704 KB Correct answer: answer = 7052481200
173 Correct 35 ms 4956 KB Correct answer: answer = 1314039500
174 Correct 44 ms 5196 KB Correct answer: answer = 302484000
175 Correct 102 ms 5804 KB Correct answer: answer = 52348480