Submission #962451

# Submission time Handle Problem Language Result Execution time Memory
962451 2024-04-13T14:41:05 Z RaresFelix Aliens (IOI16_aliens) C++17
100 / 100
946 ms 17100 KB
#include <bits/stdc++.h>
#include "aliens.h"
//#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,fma")

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;  // or double, if TL is tight
using str = string;
using ii = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;

const ll INF = 1e16;

struct CHT {
    int p = 0;
    vector<pair<ld, ld>> V;
    void insert(ld a, ld b) { /// add ax + b
        while(V.size() > 1) {
            auto [a1, b1] = V.end()[-2];
            auto [a2, b2] = V.end()[-1];
            if((b1 - b2) * (a - a2) >= (b2 - b) * (a2 - a1)) {
                V.pop_back();
            } else break;
        }
        V.push_back({a, b});
    }
    ld query(ld x) {
        if(V.empty()) return 1e30;
        auto eval = [&](pair<ld, ld> f) {
            return f.first * x + f.second;
        };
        while(p + 1 < V.size() && eval(V[p]) >= eval(V[p + 1])) ++p;
        return eval(V[p]);
    }
};

ll take_photos(int n0, int m, int k, vi r, vi c) {
    vector<ii> SegInit;
    for(int i = 0; i < n0; ++i) {
        SegInit.push_back({min(r[i], c[i]), max(r[i], c[i]) + 1});
    }
    sort(all(SegInit), [&](auto a, auto b) {
        if(a.first != b.first) return a < b;
        return a > b;
    });
    vector<ii> Seg;
    int cur_dr = -1;
    for(auto [st, dr] : SegInit) {
        if(dr <= cur_dr) continue;
        else {
            Seg.push_back({st, dr});
            cur_dr = dr;
        }
    }
    int n = Seg.size();
    vll st(n, 0), dr(n, 0), sb(n, 0);
    for(int i = 0; i < n; ++i) {
        st[i] = Seg[i].first; dr[i] = Seg[i].second;
        sb[i] = (dr[i] - st[i]) * (dr[i] - st[i]);
        if(i) {
            if(dr[i - 1] > st[i]) 
                sb[i] -= (dr[i - 1] - st[i]) * (dr[i - 1] - st[i]);
            sb[i] += sb[i - 1];
        }
    }
    auto cost = [&](int i, int j) {
        return (dr[j] - st[i]) * (dr[j] - st[i]) - (dr[i] - st[i]) * (dr[i] - st[i])
            - sb[j] + sb[i];
        return (dr[j] * dr[j] - sb[j]) 
            + (2 * st[i] * dr[i] - dr[i] * dr[i] + sb[i]) 
            - 2 * st[i] * dr[j];
    };
    ll re0 = sb.back();

    auto t = [&](ld lambda) {
        ld re = - lambda * k;
        CHT Sol;
        vector<ld> DP(n, 0.);
        for(int i = 0; i < n; ++i) {
            ld dpant = 0.;
            if(i) dpant = DP[i - 1];
            Sol.insert(- 2 * st[i], 
                        (dpant + (2 * st[i] * dr[i] - dr[i] * dr[i] + sb[i])));

            DP[i] = lambda + (ld)cost(0, i);
            ld v = lambda + (Sol.query(dr[i]) + dr[i] * dr[i] - sb[i]);
            DP[i] = min(DP[i], v);
        }
        re += DP.back();
        return re;
    };
    ld re = 0;

    ld s = 0, d = 1e14, mij;
    ld vm = 0;
    for(int i = 0; i < 100; ++i) {
        ld m1 = (2 * s + d) / 3, v1 = t(m1);
        ld m2 = (s + 2 * d) / 3, v2 = t(m2);
        vm = max(vm, v1);
        vm = max(vm, v2);
        if(v1 < v2) s = m1;
        else d = m2;
    }
    re = ll(round(vm) + 1e-8);
    re += re0;
    return re;
}

Compilation message

aliens.cpp: In member function 'ld CHT::query(ld)':
aliens.cpp:39:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long double, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         while(p + 1 < V.size() && eval(V[p]) >= eval(V[p + 1])) ++p;
      |               ~~~~~~^~~~~~~~~~
aliens.cpp: In function 'll take_photos(int, int, int, vi, vi)':
aliens.cpp:101:25: warning: unused variable 'mij' [-Wunused-variable]
  101 |     ld s = 0, d = 1e14, mij;
      |                         ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 4
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 4
4 Correct 0 ms 348 KB Correct answer: answer = 12
5 Correct 0 ms 348 KB Correct answer: answer = 52
6 Correct 1 ms 348 KB Correct answer: answer = 210
7 Correct 1 ms 344 KB Correct answer: answer = 88
8 Correct 0 ms 344 KB Correct answer: answer = 7696
9 Correct 1 ms 348 KB Correct answer: answer = 1
10 Correct 0 ms 348 KB Correct answer: answer = 2374
11 Correct 1 ms 348 KB Correct answer: answer = 9502
12 Correct 0 ms 348 KB Correct answer: answer = 49
13 Correct 1 ms 348 KB Correct answer: answer = 151
14 Correct 1 ms 348 KB Correct answer: answer = 7550
15 Correct 0 ms 436 KB Correct answer: answer = 7220
16 Correct 1 ms 600 KB Correct answer: answer = 7550
17 Correct 0 ms 348 KB Correct answer: answer = 10000
18 Correct 1 ms 344 KB Correct answer: answer = 10000
19 Correct 0 ms 348 KB Correct answer: answer = 624
20 Correct 1 ms 348 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 1
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 1 ms 344 KB Correct answer: answer = 1
4 Correct 0 ms 348 KB Correct answer: answer = 5
5 Correct 0 ms 348 KB Correct answer: answer = 41
6 Correct 1 ms 348 KB Correct answer: answer = 71923
7 Correct 2 ms 348 KB Correct answer: answer = 77137
8 Correct 3 ms 348 KB Correct answer: answer = 764
9 Correct 3 ms 348 KB Correct answer: answer = 250000
10 Correct 3 ms 344 KB Correct answer: answer = 500
11 Correct 0 ms 348 KB Correct answer: answer = 32
12 Correct 3 ms 348 KB Correct answer: answer = 130050
13 Correct 3 ms 348 KB Correct answer: answer = 5110
14 Correct 2 ms 348 KB Correct answer: answer = 2626
15 Correct 2 ms 348 KB Correct answer: answer = 796
16 Correct 4 ms 348 KB Correct answer: answer = 7580
17 Correct 4 ms 348 KB Correct answer: answer = 1904
18 Correct 3 ms 348 KB Correct answer: answer = 996004
19 Correct 4 ms 348 KB Correct answer: answer = 38817
20 Correct 3 ms 348 KB Correct answer: answer = 4096
21 Correct 0 ms 348 KB Correct answer: answer = 1
22 Correct 0 ms 348 KB Correct answer: answer = 1
23 Correct 3 ms 348 KB Correct answer: answer = 2040
24 Correct 1 ms 348 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 4
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 4
4 Correct 0 ms 348 KB Correct answer: answer = 12
5 Correct 0 ms 348 KB Correct answer: answer = 52
6 Correct 1 ms 348 KB Correct answer: answer = 210
7 Correct 1 ms 344 KB Correct answer: answer = 88
8 Correct 0 ms 344 KB Correct answer: answer = 7696
9 Correct 1 ms 348 KB Correct answer: answer = 1
10 Correct 0 ms 348 KB Correct answer: answer = 2374
11 Correct 1 ms 348 KB Correct answer: answer = 9502
12 Correct 0 ms 348 KB Correct answer: answer = 49
13 Correct 1 ms 348 KB Correct answer: answer = 151
14 Correct 1 ms 348 KB Correct answer: answer = 7550
15 Correct 0 ms 436 KB Correct answer: answer = 7220
16 Correct 1 ms 600 KB Correct answer: answer = 7550
17 Correct 0 ms 348 KB Correct answer: answer = 10000
18 Correct 1 ms 344 KB Correct answer: answer = 10000
19 Correct 0 ms 348 KB Correct answer: answer = 624
20 Correct 1 ms 348 KB Correct answer: answer = 10000
21 Correct 0 ms 348 KB Correct answer: answer = 1
22 Correct 0 ms 348 KB Correct answer: answer = 4
23 Correct 1 ms 344 KB Correct answer: answer = 1
24 Correct 0 ms 348 KB Correct answer: answer = 5
25 Correct 0 ms 348 KB Correct answer: answer = 41
26 Correct 1 ms 348 KB Correct answer: answer = 71923
27 Correct 2 ms 348 KB Correct answer: answer = 77137
28 Correct 3 ms 348 KB Correct answer: answer = 764
29 Correct 3 ms 348 KB Correct answer: answer = 250000
30 Correct 3 ms 344 KB Correct answer: answer = 500
31 Correct 0 ms 348 KB Correct answer: answer = 32
32 Correct 3 ms 348 KB Correct answer: answer = 130050
33 Correct 3 ms 348 KB Correct answer: answer = 5110
34 Correct 2 ms 348 KB Correct answer: answer = 2626
35 Correct 2 ms 348 KB Correct answer: answer = 796
36 Correct 4 ms 348 KB Correct answer: answer = 7580
37 Correct 4 ms 348 KB Correct answer: answer = 1904
38 Correct 3 ms 348 KB Correct answer: answer = 996004
39 Correct 4 ms 348 KB Correct answer: answer = 38817
40 Correct 3 ms 348 KB Correct answer: answer = 4096
41 Correct 0 ms 348 KB Correct answer: answer = 1
42 Correct 0 ms 348 KB Correct answer: answer = 1
43 Correct 3 ms 348 KB Correct answer: answer = 2040
44 Correct 1 ms 348 KB Correct answer: answer = 2
45 Correct 0 ms 348 KB Correct answer: answer = 4
46 Correct 1 ms 348 KB Correct answer: answer = 9
47 Correct 0 ms 348 KB Correct answer: answer = 9
48 Correct 1 ms 348 KB Correct answer: answer = 21
49 Correct 1 ms 344 KB Correct answer: answer = 71
50 Correct 1 ms 348 KB Correct answer: answer = 77
51 Correct 0 ms 348 KB Correct answer: answer = 400
52 Correct 1 ms 348 KB Correct answer: answer = 996004
53 Correct 1 ms 348 KB Correct answer: answer = 997310
54 Correct 1 ms 348 KB Correct answer: answer = 990781
55 Correct 1 ms 344 KB Correct answer: answer = 996545
56 Correct 1 ms 348 KB Correct answer: answer = 484
57 Correct 1 ms 348 KB Correct answer: answer = 484
58 Correct 3 ms 348 KB Correct answer: answer = 63501
59 Correct 3 ms 348 KB Correct answer: answer = 323501
60 Correct 4 ms 348 KB Correct answer: answer = 752500
61 Correct 3 ms 344 KB Correct answer: answer = 761480
62 Correct 2 ms 348 KB Correct answer: answer = 758932
63 Correct 0 ms 348 KB Correct answer: answer = 1000000
64 Correct 4 ms 344 KB Correct answer: answer = 750500
65 Correct 1 ms 348 KB Correct answer: answer = 1000000
66 Correct 1 ms 348 KB Correct answer: answer = 250000
67 Correct 1 ms 348 KB Correct answer: answer = 250000
68 Correct 1 ms 500 KB Correct answer: answer = 1000000
69 Correct 1 ms 344 KB Correct answer: answer = 994009
70 Correct 1 ms 348 KB Correct answer: answer = 59315
71 Correct 2 ms 348 KB Correct answer: answer = 25454
72 Correct 2 ms 348 KB Correct answer: answer = 1504
73 Correct 1 ms 348 KB Correct answer: answer = 37486
74 Correct 2 ms 348 KB Correct answer: answer = 4284
75 Correct 1 ms 348 KB Correct answer: answer = 158008
76 Correct 1 ms 432 KB Correct answer: answer = 51860
77 Correct 1 ms 344 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 4
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 4
4 Correct 0 ms 348 KB Correct answer: answer = 12
5 Correct 0 ms 348 KB Correct answer: answer = 52
6 Correct 1 ms 348 KB Correct answer: answer = 210
7 Correct 1 ms 344 KB Correct answer: answer = 88
8 Correct 0 ms 344 KB Correct answer: answer = 7696
9 Correct 1 ms 348 KB Correct answer: answer = 1
10 Correct 0 ms 348 KB Correct answer: answer = 2374
11 Correct 1 ms 348 KB Correct answer: answer = 9502
12 Correct 0 ms 348 KB Correct answer: answer = 49
13 Correct 1 ms 348 KB Correct answer: answer = 151
14 Correct 1 ms 348 KB Correct answer: answer = 7550
15 Correct 0 ms 436 KB Correct answer: answer = 7220
16 Correct 1 ms 600 KB Correct answer: answer = 7550
17 Correct 0 ms 348 KB Correct answer: answer = 10000
18 Correct 1 ms 344 KB Correct answer: answer = 10000
19 Correct 0 ms 348 KB Correct answer: answer = 624
20 Correct 1 ms 348 KB Correct answer: answer = 10000
21 Correct 0 ms 348 KB Correct answer: answer = 1
22 Correct 0 ms 348 KB Correct answer: answer = 4
23 Correct 1 ms 344 KB Correct answer: answer = 1
24 Correct 0 ms 348 KB Correct answer: answer = 5
25 Correct 0 ms 348 KB Correct answer: answer = 41
26 Correct 1 ms 348 KB Correct answer: answer = 71923
27 Correct 2 ms 348 KB Correct answer: answer = 77137
28 Correct 3 ms 348 KB Correct answer: answer = 764
29 Correct 3 ms 348 KB Correct answer: answer = 250000
30 Correct 3 ms 344 KB Correct answer: answer = 500
31 Correct 0 ms 348 KB Correct answer: answer = 32
32 Correct 3 ms 348 KB Correct answer: answer = 130050
33 Correct 3 ms 348 KB Correct answer: answer = 5110
34 Correct 2 ms 348 KB Correct answer: answer = 2626
35 Correct 2 ms 348 KB Correct answer: answer = 796
36 Correct 4 ms 348 KB Correct answer: answer = 7580
37 Correct 4 ms 348 KB Correct answer: answer = 1904
38 Correct 3 ms 348 KB Correct answer: answer = 996004
39 Correct 4 ms 348 KB Correct answer: answer = 38817
40 Correct 3 ms 348 KB Correct answer: answer = 4096
41 Correct 0 ms 348 KB Correct answer: answer = 1
42 Correct 0 ms 348 KB Correct answer: answer = 1
43 Correct 3 ms 348 KB Correct answer: answer = 2040
44 Correct 1 ms 348 KB Correct answer: answer = 2
45 Correct 0 ms 348 KB Correct answer: answer = 4
46 Correct 1 ms 348 KB Correct answer: answer = 9
47 Correct 0 ms 348 KB Correct answer: answer = 9
48 Correct 1 ms 348 KB Correct answer: answer = 21
49 Correct 1 ms 344 KB Correct answer: answer = 71
50 Correct 1 ms 348 KB Correct answer: answer = 77
51 Correct 0 ms 348 KB Correct answer: answer = 400
52 Correct 1 ms 348 KB Correct answer: answer = 996004
53 Correct 1 ms 348 KB Correct answer: answer = 997310
54 Correct 1 ms 348 KB Correct answer: answer = 990781
55 Correct 1 ms 344 KB Correct answer: answer = 996545
56 Correct 1 ms 348 KB Correct answer: answer = 484
57 Correct 1 ms 348 KB Correct answer: answer = 484
58 Correct 3 ms 348 KB Correct answer: answer = 63501
59 Correct 3 ms 348 KB Correct answer: answer = 323501
60 Correct 4 ms 348 KB Correct answer: answer = 752500
61 Correct 3 ms 344 KB Correct answer: answer = 761480
62 Correct 2 ms 348 KB Correct answer: answer = 758932
63 Correct 0 ms 348 KB Correct answer: answer = 1000000
64 Correct 4 ms 344 KB Correct answer: answer = 750500
65 Correct 1 ms 348 KB Correct answer: answer = 1000000
66 Correct 1 ms 348 KB Correct answer: answer = 250000
67 Correct 1 ms 348 KB Correct answer: answer = 250000
68 Correct 1 ms 500 KB Correct answer: answer = 1000000
69 Correct 1 ms 344 KB Correct answer: answer = 994009
70 Correct 1 ms 348 KB Correct answer: answer = 59315
71 Correct 2 ms 348 KB Correct answer: answer = 25454
72 Correct 2 ms 348 KB Correct answer: answer = 1504
73 Correct 1 ms 348 KB Correct answer: answer = 37486
74 Correct 2 ms 348 KB Correct answer: answer = 4284
75 Correct 1 ms 348 KB Correct answer: answer = 158008
76 Correct 1 ms 432 KB Correct answer: answer = 51860
77 Correct 1 ms 344 KB Correct answer: answer = 12985
78 Correct 2 ms 508 KB Correct answer: answer = 997864126212
79 Correct 1 ms 348 KB Correct answer: answer = 998608411647
80 Correct 2 ms 500 KB Correct answer: answer = 995265560477
81 Correct 24 ms 832 KB Correct answer: answer = 10125000
82 Correct 34 ms 1048 KB Correct answer: answer = 2291668
83 Correct 14 ms 696 KB Correct answer: answer = 42388
84 Correct 13 ms 696 KB Correct answer: answer = 10318
85 Correct 13 ms 708 KB Correct answer: answer = 3416
86 Correct 26 ms 748 KB Correct answer: answer = 331708193881
87 Correct 28 ms 608 KB Correct answer: answer = 2861193756
88 Correct 33 ms 912 KB Correct answer: answer = 114646930
89 Correct 37 ms 952 KB Correct answer: answer = 9280921
90 Correct 33 ms 960 KB Correct answer: answer = 999984053400
91 Correct 30 ms 816 KB Correct answer: answer = 750935949134
92 Correct 1 ms 348 KB Correct answer: answer = 1000000000000
93 Correct 1 ms 348 KB Correct answer: answer = 998762383161
94 Correct 26 ms 720 KB Correct answer: answer = 23017412908
95 Correct 2 ms 344 KB Correct answer: answer = 728143410622
96 Correct 1 ms 348 KB Correct answer: answer = 2
97 Correct 28 ms 896 KB Correct answer: answer = 1824916
98 Correct 26 ms 828 KB Correct answer: answer = 10680029
99 Correct 34 ms 1048 KB Correct answer: answer = 18351700
100 Correct 21 ms 604 KB Correct answer: answer = 16040026
101 Correct 4 ms 348 KB Correct answer: answer = 253968628325
102 Correct 18 ms 684 KB Correct answer: answer = 10267
103 Correct 31 ms 940 KB Correct answer: answer = 2582408
104 Correct 1 ms 348 KB Correct answer: answer = 78024964781
105 Correct 2 ms 348 KB Correct answer: answer = 9866346457
106 Correct 4 ms 348 KB Correct answer: answer = 3327720949
107 Correct 3 ms 348 KB Correct answer: answer = 86064128360
108 Correct 6 ms 604 KB Correct answer: answer = 12698259150
109 Correct 25 ms 896 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 4
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 4
4 Correct 0 ms 348 KB Correct answer: answer = 12
5 Correct 0 ms 348 KB Correct answer: answer = 52
6 Correct 1 ms 348 KB Correct answer: answer = 210
7 Correct 1 ms 344 KB Correct answer: answer = 88
8 Correct 0 ms 344 KB Correct answer: answer = 7696
9 Correct 1 ms 348 KB Correct answer: answer = 1
10 Correct 0 ms 348 KB Correct answer: answer = 2374
11 Correct 1 ms 348 KB Correct answer: answer = 9502
12 Correct 0 ms 348 KB Correct answer: answer = 49
13 Correct 1 ms 348 KB Correct answer: answer = 151
14 Correct 1 ms 348 KB Correct answer: answer = 7550
15 Correct 0 ms 436 KB Correct answer: answer = 7220
16 Correct 1 ms 600 KB Correct answer: answer = 7550
17 Correct 0 ms 348 KB Correct answer: answer = 10000
18 Correct 1 ms 344 KB Correct answer: answer = 10000
19 Correct 0 ms 348 KB Correct answer: answer = 624
20 Correct 1 ms 348 KB Correct answer: answer = 10000
21 Correct 0 ms 348 KB Correct answer: answer = 1
22 Correct 0 ms 348 KB Correct answer: answer = 4
23 Correct 1 ms 344 KB Correct answer: answer = 1
24 Correct 0 ms 348 KB Correct answer: answer = 5
25 Correct 0 ms 348 KB Correct answer: answer = 41
26 Correct 1 ms 348 KB Correct answer: answer = 71923
27 Correct 2 ms 348 KB Correct answer: answer = 77137
28 Correct 3 ms 348 KB Correct answer: answer = 764
29 Correct 3 ms 348 KB Correct answer: answer = 250000
30 Correct 3 ms 344 KB Correct answer: answer = 500
31 Correct 0 ms 348 KB Correct answer: answer = 32
32 Correct 3 ms 348 KB Correct answer: answer = 130050
33 Correct 3 ms 348 KB Correct answer: answer = 5110
34 Correct 2 ms 348 KB Correct answer: answer = 2626
35 Correct 2 ms 348 KB Correct answer: answer = 796
36 Correct 4 ms 348 KB Correct answer: answer = 7580
37 Correct 4 ms 348 KB Correct answer: answer = 1904
38 Correct 3 ms 348 KB Correct answer: answer = 996004
39 Correct 4 ms 348 KB Correct answer: answer = 38817
40 Correct 3 ms 348 KB Correct answer: answer = 4096
41 Correct 0 ms 348 KB Correct answer: answer = 1
42 Correct 0 ms 348 KB Correct answer: answer = 1
43 Correct 3 ms 348 KB Correct answer: answer = 2040
44 Correct 1 ms 348 KB Correct answer: answer = 2
45 Correct 0 ms 348 KB Correct answer: answer = 4
46 Correct 1 ms 348 KB Correct answer: answer = 9
47 Correct 0 ms 348 KB Correct answer: answer = 9
48 Correct 1 ms 348 KB Correct answer: answer = 21
49 Correct 1 ms 344 KB Correct answer: answer = 71
50 Correct 1 ms 348 KB Correct answer: answer = 77
51 Correct 0 ms 348 KB Correct answer: answer = 400
52 Correct 1 ms 348 KB Correct answer: answer = 996004
53 Correct 1 ms 348 KB Correct answer: answer = 997310
54 Correct 1 ms 348 KB Correct answer: answer = 990781
55 Correct 1 ms 344 KB Correct answer: answer = 996545
56 Correct 1 ms 348 KB Correct answer: answer = 484
57 Correct 1 ms 348 KB Correct answer: answer = 484
58 Correct 3 ms 348 KB Correct answer: answer = 63501
59 Correct 3 ms 348 KB Correct answer: answer = 323501
60 Correct 4 ms 348 KB Correct answer: answer = 752500
61 Correct 3 ms 344 KB Correct answer: answer = 761480
62 Correct 2 ms 348 KB Correct answer: answer = 758932
63 Correct 0 ms 348 KB Correct answer: answer = 1000000
64 Correct 4 ms 344 KB Correct answer: answer = 750500
65 Correct 1 ms 348 KB Correct answer: answer = 1000000
66 Correct 1 ms 348 KB Correct answer: answer = 250000
67 Correct 1 ms 348 KB Correct answer: answer = 250000
68 Correct 1 ms 500 KB Correct answer: answer = 1000000
69 Correct 1 ms 344 KB Correct answer: answer = 994009
70 Correct 1 ms 348 KB Correct answer: answer = 59315
71 Correct 2 ms 348 KB Correct answer: answer = 25454
72 Correct 2 ms 348 KB Correct answer: answer = 1504
73 Correct 1 ms 348 KB Correct answer: answer = 37486
74 Correct 2 ms 348 KB Correct answer: answer = 4284
75 Correct 1 ms 348 KB Correct answer: answer = 158008
76 Correct 1 ms 432 KB Correct answer: answer = 51860
77 Correct 1 ms 344 KB Correct answer: answer = 12985
78 Correct 2 ms 508 KB Correct answer: answer = 997864126212
79 Correct 1 ms 348 KB Correct answer: answer = 998608411647
80 Correct 2 ms 500 KB Correct answer: answer = 995265560477
81 Correct 24 ms 832 KB Correct answer: answer = 10125000
82 Correct 34 ms 1048 KB Correct answer: answer = 2291668
83 Correct 14 ms 696 KB Correct answer: answer = 42388
84 Correct 13 ms 696 KB Correct answer: answer = 10318
85 Correct 13 ms 708 KB Correct answer: answer = 3416
86 Correct 26 ms 748 KB Correct answer: answer = 331708193881
87 Correct 28 ms 608 KB Correct answer: answer = 2861193756
88 Correct 33 ms 912 KB Correct answer: answer = 114646930
89 Correct 37 ms 952 KB Correct answer: answer = 9280921
90 Correct 33 ms 960 KB Correct answer: answer = 999984053400
91 Correct 30 ms 816 KB Correct answer: answer = 750935949134
92 Correct 1 ms 348 KB Correct answer: answer = 1000000000000
93 Correct 1 ms 348 KB Correct answer: answer = 998762383161
94 Correct 26 ms 720 KB Correct answer: answer = 23017412908
95 Correct 2 ms 344 KB Correct answer: answer = 728143410622
96 Correct 1 ms 348 KB Correct answer: answer = 2
97 Correct 28 ms 896 KB Correct answer: answer = 1824916
98 Correct 26 ms 828 KB Correct answer: answer = 10680029
99 Correct 34 ms 1048 KB Correct answer: answer = 18351700
100 Correct 21 ms 604 KB Correct answer: answer = 16040026
101 Correct 4 ms 348 KB Correct answer: answer = 253968628325
102 Correct 18 ms 684 KB Correct answer: answer = 10267
103 Correct 31 ms 940 KB Correct answer: answer = 2582408
104 Correct 1 ms 348 KB Correct answer: answer = 78024964781
105 Correct 2 ms 348 KB Correct answer: answer = 9866346457
106 Correct 4 ms 348 KB Correct answer: answer = 3327720949
107 Correct 3 ms 348 KB Correct answer: answer = 86064128360
108 Correct 6 ms 604 KB Correct answer: answer = 12698259150
109 Correct 25 ms 896 KB Correct answer: answer = 1185259288
110 Correct 11 ms 1752 KB Correct answer: answer = 999889968863
111 Correct 15 ms 1752 KB Correct answer: answer = 999861384931
112 Correct 12 ms 1752 KB Correct answer: answer = 999811809929
113 Correct 11 ms 1748 KB Correct answer: answer = 999869756441
114 Correct 388 ms 5752 KB Correct answer: answer = 1700000000
115 Correct 443 ms 7880 KB Correct answer: answer = 131666670
116 Correct 97 ms 2588 KB Correct answer: answer = 89478486
117 Correct 144 ms 3112 KB Correct answer: answer = 4971040
118 Correct 132 ms 2768 KB Correct answer: answer = 2711494
119 Correct 478 ms 8256 KB Correct answer: answer = 25252530
120 Correct 491 ms 8084 KB Correct answer: answer = 62500000
121 Correct 378 ms 4604 KB Correct answer: answer = 333175097780
122 Correct 398 ms 4668 KB Correct answer: answer = 33121180179
123 Correct 416 ms 4696 KB Correct answer: answer = 9802314015
124 Correct 472 ms 8156 KB Correct answer: answer = 32567551
125 Correct 425 ms 8932 KB Correct answer: answer = 997525000000
126 Correct 365 ms 4440 KB Correct answer: answer = 752723538884
127 Correct 11 ms 2264 KB Correct answer: answer = 1000000000000
128 Correct 12 ms 2516 KB Correct answer: answer = 999978000121
129 Correct 14 ms 2404 KB Correct answer: answer = 745986144735
130 Correct 8 ms 2008 KB Correct answer: answer = 2
131 Correct 472 ms 7932 KB Correct answer: answer = 277966670
132 Correct 262 ms 4436 KB Correct answer: answer = 2500900082
133 Correct 47 ms 2516 KB Correct answer: answer = 301248349636
134 Correct 243 ms 3464 KB Correct answer: answer = 14118891
135 Correct 16 ms 2516 KB Correct answer: answer = 14384977265
136 Correct 14 ms 2352 KB Correct answer: answer = 3681368330
137 Correct 15 ms 2520 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 4
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 4
4 Correct 0 ms 348 KB Correct answer: answer = 12
5 Correct 0 ms 348 KB Correct answer: answer = 52
6 Correct 1 ms 348 KB Correct answer: answer = 210
7 Correct 1 ms 344 KB Correct answer: answer = 88
8 Correct 0 ms 344 KB Correct answer: answer = 7696
9 Correct 1 ms 348 KB Correct answer: answer = 1
10 Correct 0 ms 348 KB Correct answer: answer = 2374
11 Correct 1 ms 348 KB Correct answer: answer = 9502
12 Correct 0 ms 348 KB Correct answer: answer = 49
13 Correct 1 ms 348 KB Correct answer: answer = 151
14 Correct 1 ms 348 KB Correct answer: answer = 7550
15 Correct 0 ms 436 KB Correct answer: answer = 7220
16 Correct 1 ms 600 KB Correct answer: answer = 7550
17 Correct 0 ms 348 KB Correct answer: answer = 10000
18 Correct 1 ms 344 KB Correct answer: answer = 10000
19 Correct 0 ms 348 KB Correct answer: answer = 624
20 Correct 1 ms 348 KB Correct answer: answer = 10000
21 Correct 0 ms 348 KB Correct answer: answer = 1
22 Correct 0 ms 348 KB Correct answer: answer = 4
23 Correct 1 ms 344 KB Correct answer: answer = 1
24 Correct 0 ms 348 KB Correct answer: answer = 5
25 Correct 0 ms 348 KB Correct answer: answer = 41
26 Correct 1 ms 348 KB Correct answer: answer = 71923
27 Correct 2 ms 348 KB Correct answer: answer = 77137
28 Correct 3 ms 348 KB Correct answer: answer = 764
29 Correct 3 ms 348 KB Correct answer: answer = 250000
30 Correct 3 ms 344 KB Correct answer: answer = 500
31 Correct 0 ms 348 KB Correct answer: answer = 32
32 Correct 3 ms 348 KB Correct answer: answer = 130050
33 Correct 3 ms 348 KB Correct answer: answer = 5110
34 Correct 2 ms 348 KB Correct answer: answer = 2626
35 Correct 2 ms 348 KB Correct answer: answer = 796
36 Correct 4 ms 348 KB Correct answer: answer = 7580
37 Correct 4 ms 348 KB Correct answer: answer = 1904
38 Correct 3 ms 348 KB Correct answer: answer = 996004
39 Correct 4 ms 348 KB Correct answer: answer = 38817
40 Correct 3 ms 348 KB Correct answer: answer = 4096
41 Correct 0 ms 348 KB Correct answer: answer = 1
42 Correct 0 ms 348 KB Correct answer: answer = 1
43 Correct 3 ms 348 KB Correct answer: answer = 2040
44 Correct 1 ms 348 KB Correct answer: answer = 2
45 Correct 0 ms 348 KB Correct answer: answer = 4
46 Correct 1 ms 348 KB Correct answer: answer = 9
47 Correct 0 ms 348 KB Correct answer: answer = 9
48 Correct 1 ms 348 KB Correct answer: answer = 21
49 Correct 1 ms 344 KB Correct answer: answer = 71
50 Correct 1 ms 348 KB Correct answer: answer = 77
51 Correct 0 ms 348 KB Correct answer: answer = 400
52 Correct 1 ms 348 KB Correct answer: answer = 996004
53 Correct 1 ms 348 KB Correct answer: answer = 997310
54 Correct 1 ms 348 KB Correct answer: answer = 990781
55 Correct 1 ms 344 KB Correct answer: answer = 996545
56 Correct 1 ms 348 KB Correct answer: answer = 484
57 Correct 1 ms 348 KB Correct answer: answer = 484
58 Correct 3 ms 348 KB Correct answer: answer = 63501
59 Correct 3 ms 348 KB Correct answer: answer = 323501
60 Correct 4 ms 348 KB Correct answer: answer = 752500
61 Correct 3 ms 344 KB Correct answer: answer = 761480
62 Correct 2 ms 348 KB Correct answer: answer = 758932
63 Correct 0 ms 348 KB Correct answer: answer = 1000000
64 Correct 4 ms 344 KB Correct answer: answer = 750500
65 Correct 1 ms 348 KB Correct answer: answer = 1000000
66 Correct 1 ms 348 KB Correct answer: answer = 250000
67 Correct 1 ms 348 KB Correct answer: answer = 250000
68 Correct 1 ms 500 KB Correct answer: answer = 1000000
69 Correct 1 ms 344 KB Correct answer: answer = 994009
70 Correct 1 ms 348 KB Correct answer: answer = 59315
71 Correct 2 ms 348 KB Correct answer: answer = 25454
72 Correct 2 ms 348 KB Correct answer: answer = 1504
73 Correct 1 ms 348 KB Correct answer: answer = 37486
74 Correct 2 ms 348 KB Correct answer: answer = 4284
75 Correct 1 ms 348 KB Correct answer: answer = 158008
76 Correct 1 ms 432 KB Correct answer: answer = 51860
77 Correct 1 ms 344 KB Correct answer: answer = 12985
78 Correct 2 ms 508 KB Correct answer: answer = 997864126212
79 Correct 1 ms 348 KB Correct answer: answer = 998608411647
80 Correct 2 ms 500 KB Correct answer: answer = 995265560477
81 Correct 24 ms 832 KB Correct answer: answer = 10125000
82 Correct 34 ms 1048 KB Correct answer: answer = 2291668
83 Correct 14 ms 696 KB Correct answer: answer = 42388
84 Correct 13 ms 696 KB Correct answer: answer = 10318
85 Correct 13 ms 708 KB Correct answer: answer = 3416
86 Correct 26 ms 748 KB Correct answer: answer = 331708193881
87 Correct 28 ms 608 KB Correct answer: answer = 2861193756
88 Correct 33 ms 912 KB Correct answer: answer = 114646930
89 Correct 37 ms 952 KB Correct answer: answer = 9280921
90 Correct 33 ms 960 KB Correct answer: answer = 999984053400
91 Correct 30 ms 816 KB Correct answer: answer = 750935949134
92 Correct 1 ms 348 KB Correct answer: answer = 1000000000000
93 Correct 1 ms 348 KB Correct answer: answer = 998762383161
94 Correct 26 ms 720 KB Correct answer: answer = 23017412908
95 Correct 2 ms 344 KB Correct answer: answer = 728143410622
96 Correct 1 ms 348 KB Correct answer: answer = 2
97 Correct 28 ms 896 KB Correct answer: answer = 1824916
98 Correct 26 ms 828 KB Correct answer: answer = 10680029
99 Correct 34 ms 1048 KB Correct answer: answer = 18351700
100 Correct 21 ms 604 KB Correct answer: answer = 16040026
101 Correct 4 ms 348 KB Correct answer: answer = 253968628325
102 Correct 18 ms 684 KB Correct answer: answer = 10267
103 Correct 31 ms 940 KB Correct answer: answer = 2582408
104 Correct 1 ms 348 KB Correct answer: answer = 78024964781
105 Correct 2 ms 348 KB Correct answer: answer = 9866346457
106 Correct 4 ms 348 KB Correct answer: answer = 3327720949
107 Correct 3 ms 348 KB Correct answer: answer = 86064128360
108 Correct 6 ms 604 KB Correct answer: answer = 12698259150
109 Correct 25 ms 896 KB Correct answer: answer = 1185259288
110 Correct 11 ms 1752 KB Correct answer: answer = 999889968863
111 Correct 15 ms 1752 KB Correct answer: answer = 999861384931
112 Correct 12 ms 1752 KB Correct answer: answer = 999811809929
113 Correct 11 ms 1748 KB Correct answer: answer = 999869756441
114 Correct 388 ms 5752 KB Correct answer: answer = 1700000000
115 Correct 443 ms 7880 KB Correct answer: answer = 131666670
116 Correct 97 ms 2588 KB Correct answer: answer = 89478486
117 Correct 144 ms 3112 KB Correct answer: answer = 4971040
118 Correct 132 ms 2768 KB Correct answer: answer = 2711494
119 Correct 478 ms 8256 KB Correct answer: answer = 25252530
120 Correct 491 ms 8084 KB Correct answer: answer = 62500000
121 Correct 378 ms 4604 KB Correct answer: answer = 333175097780
122 Correct 398 ms 4668 KB Correct answer: answer = 33121180179
123 Correct 416 ms 4696 KB Correct answer: answer = 9802314015
124 Correct 472 ms 8156 KB Correct answer: answer = 32567551
125 Correct 425 ms 8932 KB Correct answer: answer = 997525000000
126 Correct 365 ms 4440 KB Correct answer: answer = 752723538884
127 Correct 11 ms 2264 KB Correct answer: answer = 1000000000000
128 Correct 12 ms 2516 KB Correct answer: answer = 999978000121
129 Correct 14 ms 2404 KB Correct answer: answer = 745986144735
130 Correct 8 ms 2008 KB Correct answer: answer = 2
131 Correct 472 ms 7932 KB Correct answer: answer = 277966670
132 Correct 262 ms 4436 KB Correct answer: answer = 2500900082
133 Correct 47 ms 2516 KB Correct answer: answer = 301248349636
134 Correct 243 ms 3464 KB Correct answer: answer = 14118891
135 Correct 16 ms 2516 KB Correct answer: answer = 14384977265
136 Correct 14 ms 2352 KB Correct answer: answer = 3681368330
137 Correct 15 ms 2520 KB Correct answer: answer = 2720316816
138 Correct 33 ms 4308 KB Correct answer: answer = 999976000144
139 Correct 23 ms 4308 KB Correct answer: answer = 999856102410
140 Correct 25 ms 4308 KB Correct answer: answer = 999958401531
141 Correct 23 ms 4300 KB Correct answer: answer = 999769649944
142 Correct 23 ms 4308 KB Correct answer: answer = 999874525918
143 Correct 747 ms 12156 KB Correct answer: answer = 6050000000
144 Correct 861 ms 17064 KB Correct answer: answer = 1112500000
145 Correct 356 ms 5976 KB Correct answer: answer = 4294967296
146 Correct 597 ms 9832 KB Correct answer: answer = 87652406
147 Correct 581 ms 10028 KB Correct answer: answer = 6297664
148 Correct 581 ms 10024 KB Correct answer: answer = 196612
149 Correct 831 ms 17100 KB Correct answer: answer = 15015100
150 Correct 874 ms 16268 KB Correct answer: answer = 25000000
151 Correct 729 ms 10404 KB Correct answer: answer = 333230209550
152 Correct 761 ms 8848 KB Correct answer: answer = 917123769
153 Correct 876 ms 16180 KB Correct answer: answer = 95162
154 Correct 904 ms 16024 KB Correct answer: answer = 382616191
155 Correct 877 ms 16032 KB Correct answer: answer = 990033333400
156 Correct 925 ms 16260 KB Correct answer: answer = 990000100000
157 Correct 708 ms 15592 KB Correct answer: answer = 749998188180
158 Correct 17 ms 4308 KB Correct answer: answer = 1000000000000
159 Correct 23 ms 4304 KB Correct answer: answer = 999988000036
160 Correct 26 ms 4308 KB Correct answer: answer = 744929274393
161 Correct 21 ms 3540 KB Correct answer: answer = 2
162 Correct 946 ms 17000 KB Correct answer: answer = 1300024
163 Correct 772 ms 12408 KB Correct answer: answer = 5000700010
164 Correct 102 ms 4560 KB Correct answer: answer = 354997100800
165 Correct 497 ms 7896 KB Correct answer: answer = 257000
166 Correct 528 ms 8508 KB Correct answer: answer = 3765323
167 Correct 529 ms 8304 KB Correct answer: answer = 1525903
168 Correct 26 ms 4308 KB Correct answer: answer = 67618137730
169 Correct 29 ms 4508 KB Correct answer: answer = 12656680171
170 Correct 40 ms 4296 KB Correct answer: answer = 579831736
171 Correct 270 ms 6484 KB Correct answer: answer = 23605611
172 Correct 49 ms 4424 KB Correct answer: answer = 7052481200
173 Correct 121 ms 5476 KB Correct answer: answer = 1314039500
174 Correct 180 ms 6852 KB Correct answer: answer = 302484000
175 Correct 457 ms 8884 KB Correct answer: answer = 52348480