Submission #500480

# Submission time Handle Problem Language Result Execution time Memory
500480 2021-12-31T07:09:10 Z dooompy Aliens (IOI16_aliens) C++17
100 / 100
192 ms 13368 KB
#include "aliens.h"
#include <bits/stdc++.h>

using namespace std;


template <typename T> void printv(T l, T r) {
    while (l != r) cout << *l << " \n"[++l == r];
}
template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) {
    return o >> a.X >> a.Y;
}
template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) {
    return o << '(' << a.first << ", " << a.second << ')';
}
template <typename T> ostream& operator << (ostream& o, vector<T> a) {
    bool is = false;
    for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;}
    return o << '}';
}

void abc() {cout << endl;}
template <typename T, typename ...U> void abc(T a, U ...b) {
    cout << a << ' ', abc(b...);
}

#ifdef local
#define test(args...) abc("[" + string(#args) + "]", args)
#else
#define test(args...) void(0)
#endif

#define ll long long

//struct line {
//    ll m, c; int id;
//
//    ll eval(ll x) {
//        return m * x + c;
//    }
//
//    long double intersectX(line o) const {
//        return (long double) (c - o.c) / (o.m - m);
//    }
//};


struct line {
    ll a, b, i;
    line(ll a=0, ll b=0, ll i=0) : a(a), b(b), i(i) {}
    ll calc(ll x) { return a*x+b;}
    double inter(line l) {
        return double(l.b - b) / (a - l.a);
    }
};
bool check_back_pd(line& p0, line& p1, line& p2) {
    return p0.inter(p1) > p1.inter(p2);
}
bool check_back(line& p0, line& p1, line& p2) {
    return (p1.b - p0.b) * (p1.a - p2.a) >= (p0.a - p1.a) * (p2.b - p1.b);
}
bool check_front_pd(ll x, line& p0, line& p1) {
    return x > p0.inter(p1);
}
bool check_front(ll x, line& p0, line& p1) {
    return x * (p0.a - p1.a) >= (p1.b - p0.b);
}

using pll = pair<ll, ll>;

struct ConvexHull {
    size_t apos = 0;
    vector<line> v;
    void insert(line p) {
        while(1) {
            size_t sz = v.size();
            if(sz - apos >= 2 && check_back_pd(v[sz-2], v[sz-1], p)) {
                v.pop_back();
                sz--;
            }
            else break;
        }
        v.push_back(p);
    }
    pll query(ll x) {
        while(1) {
            size_t sz = v.size();
            if(sz - apos >= 2 && check_front_pd(x, v[apos], v[apos+1]))
                apos++;
            else break;
        }
        return pll{v[apos].calc(x), v[apos].i};
    }
};



vector<pair<ll, ll>> points;

pair<ll, ll> ct(ll c) {
//    deque<line> dq;

//    dq.push_back({-2 * points[0].first, points[0].first * points[0].first - 2  * points[0].first, 0});

    ConvexHull dq;

    dq.insert({-2 * points[0].first, points[0].first * points[0].first - 2  * points[0].first, 0});

    ll n = points.size();
    vector<ll> ct(n + 5);
    vector<ll> dp(n + 5);

    ll total = 0;

    for (int i = 0; i < n; i++) {
//        while (dq.size() >= 2 && dq[0].eval(points[i].second) >= dq[1].eval(points[i].second)) dq.pop_front();

//        ll cur = dq.front().eval(points[i].second) + (points[i].second + 1) * (points[i].second + 1) + c;
        auto temp = dq.query(points[i].second);
        ll cur = temp.first + (points[i].second + 1) * (points[i].second + 1) + c;
        dp[i] = cur;
        total = temp.second + 1;
        ct[i + 1] = ct[temp.second] + 1;
//        ct[i + 1] = ct[dq.front().id] + 1;

        if (i == n-1) break;

        line l = {-2 * points[i+1].first, points[i + 1].first * points[i + 1].first - 2 * points[i + 1].first + dp[i] - max(points[i].second - points[i + 1].first + 1, 0LL) * max(points[i].second - points[i + 1].first + 1, 0LL), total};

        dq.insert(l);
//        while (dq.size() >= 2 && l.intersectX(dq.back()) <= dq.back().intersectX(dq[dq.size() - 2])) dq.pop_back();
//        dq.push_back(l);
    }

    return {total, dp[n-1]};
}

long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {

    for (int i = 0; i < n; i++) {
        if (r[i] > c[i]) swap(r[i], c[i]);
        points.emplace_back(r[i], c[i]);
    }

    sort(points.begin(), points.end(), [](pair<int, int> a, pair<int, int> b) {
        if (a.second == b.second) {
            return a.first > b.first;
        } else return a.second < b.second;
    });

    vector<pair<ll, ll>> final;

    for (int i = 0; i < n; i++) {
        while (!final.empty() && final.back().first >= points[i].first) final.pop_back();
        final.push_back(points[i]);

    }

    points = final;

    test(points);

    ll left = 0, right = 1e13;

    while (left != right) {
        ll mid = (left + right) / 2;
        auto cur = ct(mid);
//        if (cur.first == k) return cur.second - mid * k;
        if (cur.first > k) left = mid + 1;
        else right = mid;
    }

    test(left, k);

    auto ans = ct(left);

    test(ans);

    return ans.second  - left * (ll) k;
}

//int main() {
//    take_photos(2, 2, 1, {0, 1}, {0, 1});
//
//}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 4
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 0 ms 204 KB Correct answer: answer = 12
5 Correct 0 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 0 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 0 ms 204 KB Correct answer: answer = 2374
11 Correct 0 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 0 ms 204 KB Correct answer: answer = 151
14 Correct 0 ms 204 KB Correct answer: answer = 7550
15 Correct 0 ms 204 KB Correct answer: answer = 7220
16 Correct 0 ms 204 KB Correct answer: answer = 7550
17 Correct 0 ms 204 KB Correct answer: answer = 10000
18 Correct 0 ms 204 KB Correct answer: answer = 10000
19 Correct 0 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 1
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 1
4 Correct 0 ms 204 KB Correct answer: answer = 5
5 Correct 1 ms 204 KB Correct answer: answer = 41
6 Correct 0 ms 204 KB Correct answer: answer = 71923
7 Correct 1 ms 204 KB Correct answer: answer = 77137
8 Correct 1 ms 332 KB Correct answer: answer = 764
9 Correct 1 ms 332 KB Correct answer: answer = 250000
10 Correct 1 ms 332 KB Correct answer: answer = 500
11 Correct 0 ms 204 KB Correct answer: answer = 32
12 Correct 1 ms 332 KB Correct answer: answer = 130050
13 Correct 1 ms 332 KB Correct answer: answer = 5110
14 Correct 1 ms 204 KB Correct answer: answer = 2626
15 Correct 1 ms 204 KB Correct answer: answer = 796
16 Correct 1 ms 332 KB Correct answer: answer = 7580
17 Correct 1 ms 332 KB Correct answer: answer = 1904
18 Correct 1 ms 204 KB Correct answer: answer = 996004
19 Correct 1 ms 204 KB Correct answer: answer = 38817
20 Correct 1 ms 332 KB Correct answer: answer = 4096
21 Correct 0 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 1
23 Correct 1 ms 332 KB Correct answer: answer = 2040
24 Correct 0 ms 204 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 4
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 0 ms 204 KB Correct answer: answer = 12
5 Correct 0 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 0 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 0 ms 204 KB Correct answer: answer = 2374
11 Correct 0 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 0 ms 204 KB Correct answer: answer = 151
14 Correct 0 ms 204 KB Correct answer: answer = 7550
15 Correct 0 ms 204 KB Correct answer: answer = 7220
16 Correct 0 ms 204 KB Correct answer: answer = 7550
17 Correct 0 ms 204 KB Correct answer: answer = 10000
18 Correct 0 ms 204 KB Correct answer: answer = 10000
19 Correct 0 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 0 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 0 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 0 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 0 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 0 ms 204 KB Correct answer: answer = 1
42 Correct 0 ms 204 KB Correct answer: answer = 1
43 Correct 1 ms 332 KB Correct answer: answer = 2040
44 Correct 0 ms 204 KB Correct answer: answer = 2
45 Correct 0 ms 204 KB Correct answer: answer = 4
46 Correct 0 ms 204 KB Correct answer: answer = 9
47 Correct 0 ms 204 KB Correct answer: answer = 9
48 Correct 0 ms 204 KB Correct answer: answer = 21
49 Correct 0 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 0 ms 204 KB Correct answer: answer = 400
52 Correct 0 ms 204 KB Correct answer: answer = 996004
53 Correct 0 ms 204 KB Correct answer: answer = 997310
54 Correct 0 ms 204 KB Correct answer: answer = 990781
55 Correct 0 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 0 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 332 KB Correct answer: answer = 752500
61 Correct 1 ms 204 KB Correct answer: answer = 761480
62 Correct 1 ms 204 KB Correct answer: answer = 758932
63 Correct 0 ms 204 KB Correct answer: answer = 1000000
64 Correct 1 ms 332 KB Correct answer: answer = 750500
65 Correct 0 ms 204 KB Correct answer: answer = 1000000
66 Correct 0 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 308 KB Correct answer: answer = 250000
68 Correct 0 ms 204 KB Correct answer: answer = 1000000
69 Correct 0 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 204 KB Correct answer: answer = 25454
72 Correct 1 ms 204 KB Correct answer: answer = 1504
73 Correct 0 ms 204 KB Correct answer: answer = 37486
74 Correct 1 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 4
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 0 ms 204 KB Correct answer: answer = 12
5 Correct 0 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 0 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 0 ms 204 KB Correct answer: answer = 2374
11 Correct 0 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 0 ms 204 KB Correct answer: answer = 151
14 Correct 0 ms 204 KB Correct answer: answer = 7550
15 Correct 0 ms 204 KB Correct answer: answer = 7220
16 Correct 0 ms 204 KB Correct answer: answer = 7550
17 Correct 0 ms 204 KB Correct answer: answer = 10000
18 Correct 0 ms 204 KB Correct answer: answer = 10000
19 Correct 0 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 0 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 0 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 0 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 0 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 0 ms 204 KB Correct answer: answer = 1
42 Correct 0 ms 204 KB Correct answer: answer = 1
43 Correct 1 ms 332 KB Correct answer: answer = 2040
44 Correct 0 ms 204 KB Correct answer: answer = 2
45 Correct 0 ms 204 KB Correct answer: answer = 4
46 Correct 0 ms 204 KB Correct answer: answer = 9
47 Correct 0 ms 204 KB Correct answer: answer = 9
48 Correct 0 ms 204 KB Correct answer: answer = 21
49 Correct 0 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 0 ms 204 KB Correct answer: answer = 400
52 Correct 0 ms 204 KB Correct answer: answer = 996004
53 Correct 0 ms 204 KB Correct answer: answer = 997310
54 Correct 0 ms 204 KB Correct answer: answer = 990781
55 Correct 0 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 0 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 332 KB Correct answer: answer = 752500
61 Correct 1 ms 204 KB Correct answer: answer = 761480
62 Correct 1 ms 204 KB Correct answer: answer = 758932
63 Correct 0 ms 204 KB Correct answer: answer = 1000000
64 Correct 1 ms 332 KB Correct answer: answer = 750500
65 Correct 0 ms 204 KB Correct answer: answer = 1000000
66 Correct 0 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 308 KB Correct answer: answer = 250000
68 Correct 0 ms 204 KB Correct answer: answer = 1000000
69 Correct 0 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 204 KB Correct answer: answer = 25454
72 Correct 1 ms 204 KB Correct answer: answer = 1504
73 Correct 0 ms 204 KB Correct answer: answer = 37486
74 Correct 1 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 1 ms 460 KB Correct answer: answer = 997864126212
79 Correct 2 ms 460 KB Correct answer: answer = 998608411647
80 Correct 2 ms 504 KB Correct answer: answer = 995265560477
81 Correct 6 ms 596 KB Correct answer: answer = 10125000
82 Correct 7 ms 712 KB Correct answer: answer = 2291668
83 Correct 3 ms 428 KB Correct answer: answer = 42388
84 Correct 4 ms 460 KB Correct answer: answer = 10318
85 Correct 4 ms 424 KB Correct answer: answer = 3416
86 Correct 8 ms 588 KB Correct answer: answer = 331708193881
87 Correct 9 ms 552 KB Correct answer: answer = 2861193756
88 Correct 7 ms 748 KB Correct answer: answer = 114646930
89 Correct 6 ms 756 KB Correct answer: answer = 9280921
90 Correct 6 ms 772 KB Correct answer: answer = 999984053400
91 Correct 8 ms 556 KB Correct answer: answer = 750935949134
92 Correct 1 ms 476 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 488 KB Correct answer: answer = 998762383161
94 Correct 7 ms 488 KB Correct answer: answer = 23017412908
95 Correct 2 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 460 KB Correct answer: answer = 2
97 Correct 6 ms 736 KB Correct answer: answer = 1824916
98 Correct 5 ms 600 KB Correct answer: answer = 10680029
99 Correct 5 ms 736 KB Correct answer: answer = 18351700
100 Correct 8 ms 688 KB Correct answer: answer = 16040026
101 Correct 3 ms 428 KB Correct answer: answer = 253968628325
102 Correct 4 ms 432 KB Correct answer: answer = 10267
103 Correct 6 ms 756 KB Correct answer: answer = 2582408
104 Correct 2 ms 504 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 2 ms 420 KB Correct answer: answer = 3327720949
107 Correct 2 ms 412 KB Correct answer: answer = 86064128360
108 Correct 3 ms 580 KB Correct answer: answer = 12698259150
109 Correct 6 ms 728 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 4
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 0 ms 204 KB Correct answer: answer = 12
5 Correct 0 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 0 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 0 ms 204 KB Correct answer: answer = 2374
11 Correct 0 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 0 ms 204 KB Correct answer: answer = 151
14 Correct 0 ms 204 KB Correct answer: answer = 7550
15 Correct 0 ms 204 KB Correct answer: answer = 7220
16 Correct 0 ms 204 KB Correct answer: answer = 7550
17 Correct 0 ms 204 KB Correct answer: answer = 10000
18 Correct 0 ms 204 KB Correct answer: answer = 10000
19 Correct 0 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 0 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 0 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 0 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 0 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 0 ms 204 KB Correct answer: answer = 1
42 Correct 0 ms 204 KB Correct answer: answer = 1
43 Correct 1 ms 332 KB Correct answer: answer = 2040
44 Correct 0 ms 204 KB Correct answer: answer = 2
45 Correct 0 ms 204 KB Correct answer: answer = 4
46 Correct 0 ms 204 KB Correct answer: answer = 9
47 Correct 0 ms 204 KB Correct answer: answer = 9
48 Correct 0 ms 204 KB Correct answer: answer = 21
49 Correct 0 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 0 ms 204 KB Correct answer: answer = 400
52 Correct 0 ms 204 KB Correct answer: answer = 996004
53 Correct 0 ms 204 KB Correct answer: answer = 997310
54 Correct 0 ms 204 KB Correct answer: answer = 990781
55 Correct 0 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 0 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 332 KB Correct answer: answer = 752500
61 Correct 1 ms 204 KB Correct answer: answer = 761480
62 Correct 1 ms 204 KB Correct answer: answer = 758932
63 Correct 0 ms 204 KB Correct answer: answer = 1000000
64 Correct 1 ms 332 KB Correct answer: answer = 750500
65 Correct 0 ms 204 KB Correct answer: answer = 1000000
66 Correct 0 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 308 KB Correct answer: answer = 250000
68 Correct 0 ms 204 KB Correct answer: answer = 1000000
69 Correct 0 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 204 KB Correct answer: answer = 25454
72 Correct 1 ms 204 KB Correct answer: answer = 1504
73 Correct 0 ms 204 KB Correct answer: answer = 37486
74 Correct 1 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 1 ms 460 KB Correct answer: answer = 997864126212
79 Correct 2 ms 460 KB Correct answer: answer = 998608411647
80 Correct 2 ms 504 KB Correct answer: answer = 995265560477
81 Correct 6 ms 596 KB Correct answer: answer = 10125000
82 Correct 7 ms 712 KB Correct answer: answer = 2291668
83 Correct 3 ms 428 KB Correct answer: answer = 42388
84 Correct 4 ms 460 KB Correct answer: answer = 10318
85 Correct 4 ms 424 KB Correct answer: answer = 3416
86 Correct 8 ms 588 KB Correct answer: answer = 331708193881
87 Correct 9 ms 552 KB Correct answer: answer = 2861193756
88 Correct 7 ms 748 KB Correct answer: answer = 114646930
89 Correct 6 ms 756 KB Correct answer: answer = 9280921
90 Correct 6 ms 772 KB Correct answer: answer = 999984053400
91 Correct 8 ms 556 KB Correct answer: answer = 750935949134
92 Correct 1 ms 476 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 488 KB Correct answer: answer = 998762383161
94 Correct 7 ms 488 KB Correct answer: answer = 23017412908
95 Correct 2 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 460 KB Correct answer: answer = 2
97 Correct 6 ms 736 KB Correct answer: answer = 1824916
98 Correct 5 ms 600 KB Correct answer: answer = 10680029
99 Correct 5 ms 736 KB Correct answer: answer = 18351700
100 Correct 8 ms 688 KB Correct answer: answer = 16040026
101 Correct 3 ms 428 KB Correct answer: answer = 253968628325
102 Correct 4 ms 432 KB Correct answer: answer = 10267
103 Correct 6 ms 756 KB Correct answer: answer = 2582408
104 Correct 2 ms 504 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 2 ms 420 KB Correct answer: answer = 3327720949
107 Correct 2 ms 412 KB Correct answer: answer = 86064128360
108 Correct 3 ms 580 KB Correct answer: answer = 12698259150
109 Correct 6 ms 728 KB Correct answer: answer = 1185259288
110 Correct 15 ms 2824 KB Correct answer: answer = 999889968863
111 Correct 15 ms 2844 KB Correct answer: answer = 999861384931
112 Correct 15 ms 2884 KB Correct answer: answer = 999811809929
113 Correct 15 ms 2828 KB Correct answer: answer = 999869756441
114 Correct 69 ms 5280 KB Correct answer: answer = 1700000000
115 Correct 74 ms 6544 KB Correct answer: answer = 131666670
116 Correct 23 ms 2116 KB Correct answer: answer = 89478486
117 Correct 22 ms 2316 KB Correct answer: answer = 4971040
118 Correct 24 ms 2252 KB Correct answer: answer = 2711494
119 Correct 74 ms 6700 KB Correct answer: answer = 25252530
120 Correct 84 ms 6668 KB Correct answer: answer = 62500000
121 Correct 79 ms 4076 KB Correct answer: answer = 333175097780
122 Correct 77 ms 3988 KB Correct answer: answer = 33121180179
123 Correct 79 ms 4028 KB Correct answer: answer = 9802314015
124 Correct 78 ms 6796 KB Correct answer: answer = 32567551
125 Correct 74 ms 6812 KB Correct answer: answer = 997525000000
126 Correct 73 ms 4036 KB Correct answer: answer = 752723538884
127 Correct 12 ms 2828 KB Correct answer: answer = 1000000000000
128 Correct 15 ms 2876 KB Correct answer: answer = 999978000121
129 Correct 15 ms 2836 KB Correct answer: answer = 745986144735
130 Correct 11 ms 2364 KB Correct answer: answer = 2
131 Correct 75 ms 6488 KB Correct answer: answer = 277966670
132 Correct 69 ms 5348 KB Correct answer: answer = 2500900082
133 Correct 21 ms 2756 KB Correct answer: answer = 301248349636
134 Correct 43 ms 2788 KB Correct answer: answer = 14118891
135 Correct 16 ms 2840 KB Correct answer: answer = 14384977265
136 Correct 16 ms 2872 KB Correct answer: answer = 3681368330
137 Correct 16 ms 2840 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct answer: answer = 4
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 0 ms 204 KB Correct answer: answer = 12
5 Correct 0 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 0 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 0 ms 204 KB Correct answer: answer = 2374
11 Correct 0 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 0 ms 204 KB Correct answer: answer = 151
14 Correct 0 ms 204 KB Correct answer: answer = 7550
15 Correct 0 ms 204 KB Correct answer: answer = 7220
16 Correct 0 ms 204 KB Correct answer: answer = 7550
17 Correct 0 ms 204 KB Correct answer: answer = 10000
18 Correct 0 ms 204 KB Correct answer: answer = 10000
19 Correct 0 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 0 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 0 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 0 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 0 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 0 ms 204 KB Correct answer: answer = 1
42 Correct 0 ms 204 KB Correct answer: answer = 1
43 Correct 1 ms 332 KB Correct answer: answer = 2040
44 Correct 0 ms 204 KB Correct answer: answer = 2
45 Correct 0 ms 204 KB Correct answer: answer = 4
46 Correct 0 ms 204 KB Correct answer: answer = 9
47 Correct 0 ms 204 KB Correct answer: answer = 9
48 Correct 0 ms 204 KB Correct answer: answer = 21
49 Correct 0 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 0 ms 204 KB Correct answer: answer = 400
52 Correct 0 ms 204 KB Correct answer: answer = 996004
53 Correct 0 ms 204 KB Correct answer: answer = 997310
54 Correct 0 ms 204 KB Correct answer: answer = 990781
55 Correct 0 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 0 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 332 KB Correct answer: answer = 752500
61 Correct 1 ms 204 KB Correct answer: answer = 761480
62 Correct 1 ms 204 KB Correct answer: answer = 758932
63 Correct 0 ms 204 KB Correct answer: answer = 1000000
64 Correct 1 ms 332 KB Correct answer: answer = 750500
65 Correct 0 ms 204 KB Correct answer: answer = 1000000
66 Correct 0 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 308 KB Correct answer: answer = 250000
68 Correct 0 ms 204 KB Correct answer: answer = 1000000
69 Correct 0 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 204 KB Correct answer: answer = 25454
72 Correct 1 ms 204 KB Correct answer: answer = 1504
73 Correct 0 ms 204 KB Correct answer: answer = 37486
74 Correct 1 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 1 ms 460 KB Correct answer: answer = 997864126212
79 Correct 2 ms 460 KB Correct answer: answer = 998608411647
80 Correct 2 ms 504 KB Correct answer: answer = 995265560477
81 Correct 6 ms 596 KB Correct answer: answer = 10125000
82 Correct 7 ms 712 KB Correct answer: answer = 2291668
83 Correct 3 ms 428 KB Correct answer: answer = 42388
84 Correct 4 ms 460 KB Correct answer: answer = 10318
85 Correct 4 ms 424 KB Correct answer: answer = 3416
86 Correct 8 ms 588 KB Correct answer: answer = 331708193881
87 Correct 9 ms 552 KB Correct answer: answer = 2861193756
88 Correct 7 ms 748 KB Correct answer: answer = 114646930
89 Correct 6 ms 756 KB Correct answer: answer = 9280921
90 Correct 6 ms 772 KB Correct answer: answer = 999984053400
91 Correct 8 ms 556 KB Correct answer: answer = 750935949134
92 Correct 1 ms 476 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 488 KB Correct answer: answer = 998762383161
94 Correct 7 ms 488 KB Correct answer: answer = 23017412908
95 Correct 2 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 460 KB Correct answer: answer = 2
97 Correct 6 ms 736 KB Correct answer: answer = 1824916
98 Correct 5 ms 600 KB Correct answer: answer = 10680029
99 Correct 5 ms 736 KB Correct answer: answer = 18351700
100 Correct 8 ms 688 KB Correct answer: answer = 16040026
101 Correct 3 ms 428 KB Correct answer: answer = 253968628325
102 Correct 4 ms 432 KB Correct answer: answer = 10267
103 Correct 6 ms 756 KB Correct answer: answer = 2582408
104 Correct 2 ms 504 KB Correct answer: answer = 78024964781
105 Correct 3 ms 492 KB Correct answer: answer = 9866346457
106 Correct 2 ms 420 KB Correct answer: answer = 3327720949
107 Correct 2 ms 412 KB Correct answer: answer = 86064128360
108 Correct 3 ms 580 KB Correct answer: answer = 12698259150
109 Correct 6 ms 728 KB Correct answer: answer = 1185259288
110 Correct 15 ms 2824 KB Correct answer: answer = 999889968863
111 Correct 15 ms 2844 KB Correct answer: answer = 999861384931
112 Correct 15 ms 2884 KB Correct answer: answer = 999811809929
113 Correct 15 ms 2828 KB Correct answer: answer = 999869756441
114 Correct 69 ms 5280 KB Correct answer: answer = 1700000000
115 Correct 74 ms 6544 KB Correct answer: answer = 131666670
116 Correct 23 ms 2116 KB Correct answer: answer = 89478486
117 Correct 22 ms 2316 KB Correct answer: answer = 4971040
118 Correct 24 ms 2252 KB Correct answer: answer = 2711494
119 Correct 74 ms 6700 KB Correct answer: answer = 25252530
120 Correct 84 ms 6668 KB Correct answer: answer = 62500000
121 Correct 79 ms 4076 KB Correct answer: answer = 333175097780
122 Correct 77 ms 3988 KB Correct answer: answer = 33121180179
123 Correct 79 ms 4028 KB Correct answer: answer = 9802314015
124 Correct 78 ms 6796 KB Correct answer: answer = 32567551
125 Correct 74 ms 6812 KB Correct answer: answer = 997525000000
126 Correct 73 ms 4036 KB Correct answer: answer = 752723538884
127 Correct 12 ms 2828 KB Correct answer: answer = 1000000000000
128 Correct 15 ms 2876 KB Correct answer: answer = 999978000121
129 Correct 15 ms 2836 KB Correct answer: answer = 745986144735
130 Correct 11 ms 2364 KB Correct answer: answer = 2
131 Correct 75 ms 6488 KB Correct answer: answer = 277966670
132 Correct 69 ms 5348 KB Correct answer: answer = 2500900082
133 Correct 21 ms 2756 KB Correct answer: answer = 301248349636
134 Correct 43 ms 2788 KB Correct answer: answer = 14118891
135 Correct 16 ms 2840 KB Correct answer: answer = 14384977265
136 Correct 16 ms 2872 KB Correct answer: answer = 3681368330
137 Correct 16 ms 2840 KB Correct answer: answer = 2720316816
138 Correct 30 ms 5272 KB Correct answer: answer = 999976000144
139 Correct 33 ms 5392 KB Correct answer: answer = 999856102410
140 Correct 33 ms 5356 KB Correct answer: answer = 999958401531
141 Correct 30 ms 5396 KB Correct answer: answer = 999769649944
142 Correct 31 ms 5348 KB Correct answer: answer = 999874525918
143 Correct 135 ms 10284 KB Correct answer: answer = 6050000000
144 Correct 158 ms 12452 KB Correct answer: answer = 1112500000
145 Correct 98 ms 7708 KB Correct answer: answer = 4294967296
146 Correct 98 ms 8168 KB Correct answer: answer = 87652406
147 Correct 95 ms 8308 KB Correct answer: answer = 6297664
148 Correct 92 ms 8312 KB Correct answer: answer = 196612
149 Correct 159 ms 13288 KB Correct answer: answer = 15015100
150 Correct 154 ms 13164 KB Correct answer: answer = 25000000
151 Correct 152 ms 7820 KB Correct answer: answer = 333230209550
152 Correct 151 ms 8076 KB Correct answer: answer = 917123769
153 Correct 170 ms 13192 KB Correct answer: answer = 95162
154 Correct 161 ms 13044 KB Correct answer: answer = 382616191
155 Correct 156 ms 13344 KB Correct answer: answer = 990033333400
156 Correct 192 ms 13368 KB Correct answer: answer = 990000100000
157 Correct 149 ms 11920 KB Correct answer: answer = 749998188180
158 Correct 21 ms 5264 KB Correct answer: answer = 1000000000000
159 Correct 30 ms 5276 KB Correct answer: answer = 999988000036
160 Correct 32 ms 5260 KB Correct answer: answer = 744929274393
161 Correct 19 ms 4408 KB Correct answer: answer = 2
162 Correct 167 ms 13212 KB Correct answer: answer = 1300024
163 Correct 142 ms 10488 KB Correct answer: answer = 5000700010
164 Correct 43 ms 5304 KB Correct answer: answer = 354997100800
165 Correct 90 ms 6660 KB Correct answer: answer = 257000
166 Correct 86 ms 6876 KB Correct answer: answer = 3765323
167 Correct 90 ms 6796 KB Correct answer: answer = 1525903
168 Correct 30 ms 5388 KB Correct answer: answer = 67618137730
169 Correct 31 ms 5304 KB Correct answer: answer = 12656680171
170 Correct 35 ms 5352 KB Correct answer: answer = 579831736
171 Correct 63 ms 6416 KB Correct answer: answer = 23605611
172 Correct 35 ms 5304 KB Correct answer: answer = 7052481200
173 Correct 40 ms 5772 KB Correct answer: answer = 1314039500
174 Correct 47 ms 6692 KB Correct answer: answer = 302484000
175 Correct 79 ms 7860 KB Correct answer: answer = 52348480