Submission #393345

# Submission time Handle Problem Language Result Execution time Memory
393345 2021-04-23T08:29:31 Z Tc14 Aliens (IOI16_aliens) C++17
100 / 100
349 ms 12940 KB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
const ll LLINF = (ll)1e18 + 10;

ve<pii> P;
ve<ll> L;
int a;

struct segment {
    ll m, b, l, r, k;
};

double intersect(ll m1, ll m2, ll b1, ll b2) {
    return (double) (b1 - b2) / (double) (m2 - m1);
}

ll sq(int x) { return (ll)x*x; }

pair<ll, ll> calc(ll lambda) {

    ve<ll> DP(a), T(a);
    list<segment> H;

    DP[0] = sq(P[0].second - P[0].first + 1) + lambda;
    T[0] = 1;

    for (int i = 1; i < a; i++) {

        ll x = -P[i].first + 1;
        ll b = DP[i - 1] - L[i] + x * x;
        ll m = 2 * x;

        if (H.size() == 0) H.push_back({m, b, -LLINF, LLINF, T[i - 1]});
        else {

            while (intersect(H.back().m, m, H.back().b, b) <= (double)H.back().l) {
                H.pop_back();
            }

            double z = intersect(H.back().m, m, H.back().b, b);

            ll l = (ll)ceil(z);
            H.back().r = (ll)floor(z);

            H.push_back({m, b, l, LLINF, T[i - 1]});
        }

        while (H.begin()->r < P[i].second) {
            H.pop_front();
        }
        H.begin()->l = -LLINF;

        ll q = H.begin()->m * P[i].second + H.begin()->b;
        ll v = q + sq(P[i].second) + lambda;

        DP[i] = sq(P[i].second - P[0].first + 1) + lambda;
        T[i] = 1;

        if (DP[i] > v) {
            DP[i] = v;
            T[i] = H.begin()->k + 1;
        }
    }

    return {DP[a - 1], T[a - 1]};
}

ll take_photos(int n, int m, int k, ve<int> R, ve<int> C) {

    map<int, int> M;

    for (int i = 0; i < n; i++) {
        int r = R[i];
        int c = C[i];
        if (c < r) swap(r, c);
        if (M.find(r) == M.end()) M[r] = c;
        else M[r] = max(M[r], c);
    }

    int cOld = -1;
    a = 0;
    for (pii p : M) {
        int r, c;
        tie(r, c) = p;
        if (c > cOld) {
            cOld = c;
            P.push_back({r, c});
            a++;
        }
    }

    L = ve<ll>(a);
    for (int i = 1; i < a; i++) {
        if (P[i - 1].second >= P[i].first) {
            L[i] = sq(P[i - 1].second - P[i].first + 1);
        }
    }

    ll lo = 0;
    ll hi = (ll)2e12;
    ll v, t, mid;

    while (lo < hi) {
 
        mid = (lo + hi) / 2;
 
        tie(v, t) = calc(mid);
 
        if (t > min(a, k)) lo = mid + 1;
        else if (t <= min(a, k)) hi = mid;
    }
    
    tie(v, t) = calc(lo);
    
    return v - min(a, k) * lo;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 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 1 ms 204 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 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 1 ms 204 KB Correct answer: answer = 1
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 1
4 Correct 1 ms 204 KB Correct answer: answer = 5
5 Correct 1 ms 204 KB Correct answer: answer = 41
6 Correct 1 ms 204 KB Correct answer: answer = 71923
7 Correct 1 ms 204 KB Correct answer: answer = 77137
8 Correct 2 ms 332 KB Correct answer: answer = 764
9 Correct 2 ms 332 KB Correct answer: answer = 250000
10 Correct 2 ms 332 KB Correct answer: answer = 500
11 Correct 1 ms 204 KB Correct answer: answer = 32
12 Correct 2 ms 332 KB Correct answer: answer = 130050
13 Correct 2 ms 332 KB Correct answer: answer = 5110
14 Correct 2 ms 204 KB Correct answer: answer = 2626
15 Correct 2 ms 204 KB Correct answer: answer = 796
16 Correct 2 ms 332 KB Correct answer: answer = 7580
17 Correct 2 ms 332 KB Correct answer: answer = 1904
18 Correct 2 ms 332 KB Correct answer: answer = 996004
19 Correct 2 ms 332 KB Correct answer: answer = 38817
20 Correct 2 ms 332 KB Correct answer: answer = 4096
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 1
23 Correct 2 ms 332 KB Correct answer: answer = 2040
24 Correct 1 ms 204 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 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 1 ms 204 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 2 ms 332 KB Correct answer: answer = 764
29 Correct 2 ms 332 KB Correct answer: answer = 250000
30 Correct 2 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 2 ms 332 KB Correct answer: answer = 130050
33 Correct 2 ms 332 KB Correct answer: answer = 5110
34 Correct 2 ms 204 KB Correct answer: answer = 2626
35 Correct 2 ms 204 KB Correct answer: answer = 796
36 Correct 2 ms 332 KB Correct answer: answer = 7580
37 Correct 2 ms 332 KB Correct answer: answer = 1904
38 Correct 2 ms 332 KB Correct answer: answer = 996004
39 Correct 2 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 332 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 1 ms 208 KB Correct answer: answer = 400
52 Correct 1 ms 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 2 ms 332 KB Correct answer: answer = 63501
59 Correct 2 ms 332 KB Correct answer: answer = 323501
60 Correct 2 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 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 2 ms 332 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 332 KB Correct answer: answer = 25454
72 Correct 1 ms 332 KB Correct answer: answer = 1504
73 Correct 1 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 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 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 1 ms 204 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 2 ms 332 KB Correct answer: answer = 764
29 Correct 2 ms 332 KB Correct answer: answer = 250000
30 Correct 2 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 2 ms 332 KB Correct answer: answer = 130050
33 Correct 2 ms 332 KB Correct answer: answer = 5110
34 Correct 2 ms 204 KB Correct answer: answer = 2626
35 Correct 2 ms 204 KB Correct answer: answer = 796
36 Correct 2 ms 332 KB Correct answer: answer = 7580
37 Correct 2 ms 332 KB Correct answer: answer = 1904
38 Correct 2 ms 332 KB Correct answer: answer = 996004
39 Correct 2 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 332 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 1 ms 208 KB Correct answer: answer = 400
52 Correct 1 ms 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 2 ms 332 KB Correct answer: answer = 63501
59 Correct 2 ms 332 KB Correct answer: answer = 323501
60 Correct 2 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 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 2 ms 332 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 332 KB Correct answer: answer = 25454
72 Correct 1 ms 332 KB Correct answer: answer = 1504
73 Correct 1 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 3 ms 460 KB Correct answer: answer = 997864126212
79 Correct 3 ms 460 KB Correct answer: answer = 998608411647
80 Correct 3 ms 524 KB Correct answer: answer = 995265560477
81 Correct 12 ms 716 KB Correct answer: answer = 10125000
82 Correct 12 ms 716 KB Correct answer: answer = 2291668
83 Correct 6 ms 460 KB Correct answer: answer = 42388
84 Correct 6 ms 460 KB Correct answer: answer = 10318
85 Correct 6 ms 460 KB Correct answer: answer = 3416
86 Correct 14 ms 704 KB Correct answer: answer = 331708193881
87 Correct 13 ms 704 KB Correct answer: answer = 2861193756
88 Correct 12 ms 696 KB Correct answer: answer = 114646930
89 Correct 11 ms 796 KB Correct answer: answer = 9280921
90 Correct 12 ms 716 KB Correct answer: answer = 999984053400
91 Correct 13 ms 588 KB Correct answer: answer = 750935949134
92 Correct 2 ms 464 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 460 KB Correct answer: answer = 998762383161
94 Correct 12 ms 588 KB Correct answer: answer = 23017412908
95 Correct 3 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 12 ms 720 KB Correct answer: answer = 1824916
98 Correct 10 ms 588 KB Correct answer: answer = 10680029
99 Correct 11 ms 680 KB Correct answer: answer = 18351700
100 Correct 12 ms 796 KB Correct answer: answer = 16040026
101 Correct 4 ms 460 KB Correct answer: answer = 253968628325
102 Correct 6 ms 460 KB Correct answer: answer = 10267
103 Correct 11 ms 716 KB Correct answer: answer = 2582408
104 Correct 3 ms 460 KB Correct answer: answer = 78024964781
105 Correct 3 ms 460 KB Correct answer: answer = 9866346457
106 Correct 4 ms 460 KB Correct answer: answer = 3327720949
107 Correct 3 ms 460 KB Correct answer: answer = 86064128360
108 Correct 5 ms 576 KB Correct answer: answer = 12698259150
109 Correct 10 ms 588 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 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 1 ms 204 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 2 ms 332 KB Correct answer: answer = 764
29 Correct 2 ms 332 KB Correct answer: answer = 250000
30 Correct 2 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 2 ms 332 KB Correct answer: answer = 130050
33 Correct 2 ms 332 KB Correct answer: answer = 5110
34 Correct 2 ms 204 KB Correct answer: answer = 2626
35 Correct 2 ms 204 KB Correct answer: answer = 796
36 Correct 2 ms 332 KB Correct answer: answer = 7580
37 Correct 2 ms 332 KB Correct answer: answer = 1904
38 Correct 2 ms 332 KB Correct answer: answer = 996004
39 Correct 2 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 332 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 1 ms 208 KB Correct answer: answer = 400
52 Correct 1 ms 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 2 ms 332 KB Correct answer: answer = 63501
59 Correct 2 ms 332 KB Correct answer: answer = 323501
60 Correct 2 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 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 2 ms 332 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 332 KB Correct answer: answer = 25454
72 Correct 1 ms 332 KB Correct answer: answer = 1504
73 Correct 1 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 3 ms 460 KB Correct answer: answer = 997864126212
79 Correct 3 ms 460 KB Correct answer: answer = 998608411647
80 Correct 3 ms 524 KB Correct answer: answer = 995265560477
81 Correct 12 ms 716 KB Correct answer: answer = 10125000
82 Correct 12 ms 716 KB Correct answer: answer = 2291668
83 Correct 6 ms 460 KB Correct answer: answer = 42388
84 Correct 6 ms 460 KB Correct answer: answer = 10318
85 Correct 6 ms 460 KB Correct answer: answer = 3416
86 Correct 14 ms 704 KB Correct answer: answer = 331708193881
87 Correct 13 ms 704 KB Correct answer: answer = 2861193756
88 Correct 12 ms 696 KB Correct answer: answer = 114646930
89 Correct 11 ms 796 KB Correct answer: answer = 9280921
90 Correct 12 ms 716 KB Correct answer: answer = 999984053400
91 Correct 13 ms 588 KB Correct answer: answer = 750935949134
92 Correct 2 ms 464 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 460 KB Correct answer: answer = 998762383161
94 Correct 12 ms 588 KB Correct answer: answer = 23017412908
95 Correct 3 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 12 ms 720 KB Correct answer: answer = 1824916
98 Correct 10 ms 588 KB Correct answer: answer = 10680029
99 Correct 11 ms 680 KB Correct answer: answer = 18351700
100 Correct 12 ms 796 KB Correct answer: answer = 16040026
101 Correct 4 ms 460 KB Correct answer: answer = 253968628325
102 Correct 6 ms 460 KB Correct answer: answer = 10267
103 Correct 11 ms 716 KB Correct answer: answer = 2582408
104 Correct 3 ms 460 KB Correct answer: answer = 78024964781
105 Correct 3 ms 460 KB Correct answer: answer = 9866346457
106 Correct 4 ms 460 KB Correct answer: answer = 3327720949
107 Correct 3 ms 460 KB Correct answer: answer = 86064128360
108 Correct 5 ms 576 KB Correct answer: answer = 12698259150
109 Correct 10 ms 588 KB Correct answer: answer = 1185259288
110 Correct 36 ms 3332 KB Correct answer: answer = 999889968863
111 Correct 36 ms 3348 KB Correct answer: answer = 999861384931
112 Correct 35 ms 3296 KB Correct answer: answer = 999811809929
113 Correct 35 ms 3296 KB Correct answer: answer = 999869756441
114 Correct 156 ms 6236 KB Correct answer: answer = 1700000000
115 Correct 146 ms 6256 KB Correct answer: answer = 131666670
116 Correct 46 ms 2356 KB Correct answer: answer = 89478486
117 Correct 47 ms 2392 KB Correct answer: answer = 4971040
118 Correct 42 ms 2360 KB Correct answer: answer = 2711494
119 Correct 143 ms 6544 KB Correct answer: answer = 25252530
120 Correct 135 ms 6584 KB Correct answer: answer = 62500000
121 Correct 154 ms 5008 KB Correct answer: answer = 333175097780
122 Correct 158 ms 4924 KB Correct answer: answer = 33121180179
123 Correct 156 ms 4920 KB Correct answer: answer = 9802314015
124 Correct 141 ms 6564 KB Correct answer: answer = 32567551
125 Correct 142 ms 6552 KB Correct answer: answer = 997525000000
126 Correct 146 ms 4888 KB Correct answer: answer = 752723538884
127 Correct 26 ms 3368 KB Correct answer: answer = 1000000000000
128 Correct 34 ms 3276 KB Correct answer: answer = 999978000121
129 Correct 35 ms 3256 KB Correct answer: answer = 745986144735
130 Correct 10 ms 1080 KB Correct answer: answer = 2
131 Correct 152 ms 6544 KB Correct answer: answer = 277966670
132 Correct 164 ms 6676 KB Correct answer: answer = 2500900082
133 Correct 55 ms 2756 KB Correct answer: answer = 301248349636
134 Correct 78 ms 3044 KB Correct answer: answer = 14118891
135 Correct 35 ms 2892 KB Correct answer: answer = 14384977265
136 Correct 35 ms 2872 KB Correct answer: answer = 3681368330
137 Correct 35 ms 3012 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 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 1 ms 204 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 2 ms 332 KB Correct answer: answer = 764
29 Correct 2 ms 332 KB Correct answer: answer = 250000
30 Correct 2 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 2 ms 332 KB Correct answer: answer = 130050
33 Correct 2 ms 332 KB Correct answer: answer = 5110
34 Correct 2 ms 204 KB Correct answer: answer = 2626
35 Correct 2 ms 204 KB Correct answer: answer = 796
36 Correct 2 ms 332 KB Correct answer: answer = 7580
37 Correct 2 ms 332 KB Correct answer: answer = 1904
38 Correct 2 ms 332 KB Correct answer: answer = 996004
39 Correct 2 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 332 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 204 KB Correct answer: answer = 77
51 Correct 1 ms 208 KB Correct answer: answer = 400
52 Correct 1 ms 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 2 ms 332 KB Correct answer: answer = 63501
59 Correct 2 ms 332 KB Correct answer: answer = 323501
60 Correct 2 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 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 2 ms 332 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 204 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 1 ms 332 KB Correct answer: answer = 25454
72 Correct 1 ms 332 KB Correct answer: answer = 1504
73 Correct 1 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 3 ms 460 KB Correct answer: answer = 997864126212
79 Correct 3 ms 460 KB Correct answer: answer = 998608411647
80 Correct 3 ms 524 KB Correct answer: answer = 995265560477
81 Correct 12 ms 716 KB Correct answer: answer = 10125000
82 Correct 12 ms 716 KB Correct answer: answer = 2291668
83 Correct 6 ms 460 KB Correct answer: answer = 42388
84 Correct 6 ms 460 KB Correct answer: answer = 10318
85 Correct 6 ms 460 KB Correct answer: answer = 3416
86 Correct 14 ms 704 KB Correct answer: answer = 331708193881
87 Correct 13 ms 704 KB Correct answer: answer = 2861193756
88 Correct 12 ms 696 KB Correct answer: answer = 114646930
89 Correct 11 ms 796 KB Correct answer: answer = 9280921
90 Correct 12 ms 716 KB Correct answer: answer = 999984053400
91 Correct 13 ms 588 KB Correct answer: answer = 750935949134
92 Correct 2 ms 464 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 460 KB Correct answer: answer = 998762383161
94 Correct 12 ms 588 KB Correct answer: answer = 23017412908
95 Correct 3 ms 460 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 12 ms 720 KB Correct answer: answer = 1824916
98 Correct 10 ms 588 KB Correct answer: answer = 10680029
99 Correct 11 ms 680 KB Correct answer: answer = 18351700
100 Correct 12 ms 796 KB Correct answer: answer = 16040026
101 Correct 4 ms 460 KB Correct answer: answer = 253968628325
102 Correct 6 ms 460 KB Correct answer: answer = 10267
103 Correct 11 ms 716 KB Correct answer: answer = 2582408
104 Correct 3 ms 460 KB Correct answer: answer = 78024964781
105 Correct 3 ms 460 KB Correct answer: answer = 9866346457
106 Correct 4 ms 460 KB Correct answer: answer = 3327720949
107 Correct 3 ms 460 KB Correct answer: answer = 86064128360
108 Correct 5 ms 576 KB Correct answer: answer = 12698259150
109 Correct 10 ms 588 KB Correct answer: answer = 1185259288
110 Correct 36 ms 3332 KB Correct answer: answer = 999889968863
111 Correct 36 ms 3348 KB Correct answer: answer = 999861384931
112 Correct 35 ms 3296 KB Correct answer: answer = 999811809929
113 Correct 35 ms 3296 KB Correct answer: answer = 999869756441
114 Correct 156 ms 6236 KB Correct answer: answer = 1700000000
115 Correct 146 ms 6256 KB Correct answer: answer = 131666670
116 Correct 46 ms 2356 KB Correct answer: answer = 89478486
117 Correct 47 ms 2392 KB Correct answer: answer = 4971040
118 Correct 42 ms 2360 KB Correct answer: answer = 2711494
119 Correct 143 ms 6544 KB Correct answer: answer = 25252530
120 Correct 135 ms 6584 KB Correct answer: answer = 62500000
121 Correct 154 ms 5008 KB Correct answer: answer = 333175097780
122 Correct 158 ms 4924 KB Correct answer: answer = 33121180179
123 Correct 156 ms 4920 KB Correct answer: answer = 9802314015
124 Correct 141 ms 6564 KB Correct answer: answer = 32567551
125 Correct 142 ms 6552 KB Correct answer: answer = 997525000000
126 Correct 146 ms 4888 KB Correct answer: answer = 752723538884
127 Correct 26 ms 3368 KB Correct answer: answer = 1000000000000
128 Correct 34 ms 3276 KB Correct answer: answer = 999978000121
129 Correct 35 ms 3256 KB Correct answer: answer = 745986144735
130 Correct 10 ms 1080 KB Correct answer: answer = 2
131 Correct 152 ms 6544 KB Correct answer: answer = 277966670
132 Correct 164 ms 6676 KB Correct answer: answer = 2500900082
133 Correct 55 ms 2756 KB Correct answer: answer = 301248349636
134 Correct 78 ms 3044 KB Correct answer: answer = 14118891
135 Correct 35 ms 2892 KB Correct answer: answer = 14384977265
136 Correct 35 ms 2872 KB Correct answer: answer = 3681368330
137 Correct 35 ms 3012 KB Correct answer: answer = 2720316816
138 Correct 75 ms 6212 KB Correct answer: answer = 999976000144
139 Correct 75 ms 6212 KB Correct answer: answer = 999856102410
140 Correct 74 ms 6212 KB Correct answer: answer = 999958401531
141 Correct 75 ms 6196 KB Correct answer: answer = 999769649944
142 Correct 75 ms 6204 KB Correct answer: answer = 999874525918
143 Correct 318 ms 12508 KB Correct answer: answer = 6050000000
144 Correct 301 ms 12460 KB Correct answer: answer = 1112500000
145 Correct 203 ms 8560 KB Correct answer: answer = 4294967296
146 Correct 194 ms 8492 KB Correct answer: answer = 87652406
147 Correct 184 ms 8508 KB Correct answer: answer = 6297664
148 Correct 178 ms 8524 KB Correct answer: answer = 196612
149 Correct 289 ms 12940 KB Correct answer: answer = 15015100
150 Correct 272 ms 12816 KB Correct answer: answer = 25000000
151 Correct 312 ms 9424 KB Correct answer: answer = 333230209550
152 Correct 308 ms 9332 KB Correct answer: answer = 917123769
153 Correct 299 ms 9428 KB Correct answer: answer = 95162
154 Correct 301 ms 12912 KB Correct answer: answer = 382616191
155 Correct 304 ms 12808 KB Correct answer: answer = 990033333400
156 Correct 297 ms 12888 KB Correct answer: answer = 990000100000
157 Correct 268 ms 8748 KB Correct answer: answer = 749998188180
158 Correct 56 ms 6504 KB Correct answer: answer = 1000000000000
159 Correct 71 ms 5996 KB Correct answer: answer = 999988000036
160 Correct 74 ms 6076 KB Correct answer: answer = 744929274393
161 Correct 19 ms 1860 KB Correct answer: answer = 2
162 Correct 291 ms 12792 KB Correct answer: answer = 1300024
163 Correct 349 ms 12808 KB Correct answer: answer = 5000700010
164 Correct 103 ms 5260 KB Correct answer: answer = 354997100800
165 Correct 157 ms 5852 KB Correct answer: answer = 257000
166 Correct 148 ms 7220 KB Correct answer: answer = 3765323
167 Correct 155 ms 6828 KB Correct answer: answer = 1525903
168 Correct 77 ms 5316 KB Correct answer: answer = 67618137730
169 Correct 77 ms 5556 KB Correct answer: answer = 12656680171
170 Correct 79 ms 5412 KB Correct answer: answer = 579831736
171 Correct 140 ms 6336 KB Correct answer: answer = 23605611
172 Correct 83 ms 6204 KB Correct answer: answer = 7052481200
173 Correct 105 ms 6648 KB Correct answer: answer = 1314039500
174 Correct 123 ms 6984 KB Correct answer: answer = 302484000
175 Correct 199 ms 8672 KB Correct answer: answer = 52348480