Submission #58387

# Submission time Handle Problem Language Result Execution time Memory
58387 2018-07-17T16:18:44 Z FLDutchman Aliens (IOI16_aliens) C++14
60 / 100
2000 ms 385036 KB
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;

typedef int INT;

#define pb push_back
#define FOR(i, l, r) for(int i = (l); i < (r); i++)
#define fst first
#define snd second
#define int long long

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;

const ll INF = 1e15;

struct line{
    int m, q;
    line (int M, int Q) {
        m = M;
        q = Q;
    }
    bool operator< (const line &l){
        return make_pair(m, q) < make_pair(l.m, l.q);
    }
    int eval(int x){
        return m*x+q;
    }
};

double intersect(const line &l1, const line &l2){
    return (long double) (l1.q - l2.q) / (l2.m - l1.m);
}

bool bad(const line &l1, const line &l2, const line &l3){
    return (l3.q-l2.q) * (l2.m - l1.m) < (l1.q - l2.q) * (l2.m - l3.m);
}

// MAX hull, slopes increasing
struct hull{
    deque<line> slopes;

    void insert(line l){
        while(slopes.size() >= 2 and bad(*prev(slopes.end(), 2), slopes.back(), l))  slopes.pop_back();
        slopes.push_back(l);
    }

    int get(int x){
        while(slopes.size() != 1 and slopes[0].eval(x) <= slopes[1].eval(x)) slopes.pop_front();
        return slopes[0].eval(x);
    }
};


vi C, R;
vii points;

int sqr(int x) {return x*x;}

long long take_photos(INT n, INT m, INT k, std::vector<INT> r, std::vector<INT> c) {
    FOR(i, 0, n) if(c[i] < r[i]) swap(r[i], c[i]);
    FOR(i, 0, n) points.pb({r[i], c[i]});

    points.pb({INF, INF});
    sort(points.begin(), points.end());
    FOR(i, 0, n){
        if(points[i].fst != points[i+1].fst){
            if(C.size() == 0 || points[i].snd > C.back()) {R.pb(points[i].fst); C.pb(points[i].snd);}
        }
    }
    //FOR(i, 0, C.size()){
    //    cout << R[i] << " " << C[i] << endl;
    //}
    vector<vi> dp;
    int N = C.size();
    dp.assign(N+1, vi(k+1, -1));
    FOR(i, 0, N) dp[i][0] = INF;
    FOR(K, 0, k+1) dp[N][K] = 0;
    FOR(K, 1, k+1){
        hull h;
        for(int i = N-1; i >= 0; i--){
            h.insert({2*(C[i] +1), -sqr(C[i]+1) - dp[i+1][K-1]});
            dp[i][K] = sqr(R[i]) - ( i == 0 ? 0 : sqr(max(0LL, C[i-1] + 1 - R[i])) ) - h.get(R[i]);
            //int mi = INF;
            //FOR(j, i+1, N+1) mi = min(mi, dp[j][K-1] + sqr(C[j-1]+1 - R[i]) - (i == 0 || C[i-1]+1-R[i] < 0 ? 0 : sqr(C[i-1]+1-R[i]) ) );
            //dp[i][K] = mi;
        }
    }
    //FOR(K, 0, k+1) {
    //    FOR(i, 0, N+1) cout << dp[i][K] << " ";
    //    cout<<endl;
    //}

    return dp[0][k];
}


/*
5 7 2
0 3
4 4
4 6
4 5
4 6

4 7 2
4 4
4 6
4 5
4 6

2 7 2
0 1
1 3

2 7 2
0 1
5 7
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 3 ms 484 KB Correct answer: answer = 4
3 Correct 2 ms 484 KB Correct answer: answer = 4
4 Correct 3 ms 484 KB Correct answer: answer = 12
5 Correct 2 ms 560 KB Correct answer: answer = 52
6 Correct 2 ms 588 KB Correct answer: answer = 210
7 Correct 2 ms 588 KB Correct answer: answer = 88
8 Correct 3 ms 588 KB Correct answer: answer = 7696
9 Correct 2 ms 588 KB Correct answer: answer = 1
10 Correct 3 ms 628 KB Correct answer: answer = 2374
11 Correct 2 ms 628 KB Correct answer: answer = 9502
12 Correct 2 ms 628 KB Correct answer: answer = 49
13 Correct 2 ms 644 KB Correct answer: answer = 151
14 Correct 2 ms 644 KB Correct answer: answer = 7550
15 Correct 3 ms 644 KB Correct answer: answer = 7220
16 Correct 3 ms 644 KB Correct answer: answer = 7550
17 Correct 3 ms 644 KB Correct answer: answer = 10000
18 Correct 2 ms 644 KB Correct answer: answer = 10000
19 Correct 2 ms 644 KB Correct answer: answer = 624
20 Correct 2 ms 644 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 3 ms 644 KB Correct answer: answer = 1
2 Correct 3 ms 644 KB Correct answer: answer = 4
3 Correct 3 ms 644 KB Correct answer: answer = 1
4 Correct 2 ms 644 KB Correct answer: answer = 5
5 Correct 3 ms 644 KB Correct answer: answer = 41
6 Correct 2 ms 644 KB Correct answer: answer = 71923
7 Correct 2 ms 644 KB Correct answer: answer = 77137
8 Correct 7 ms 1404 KB Correct answer: answer = 764
9 Correct 2 ms 1404 KB Correct answer: answer = 250000
10 Correct 14 ms 2556 KB Correct answer: answer = 500
11 Correct 2 ms 2556 KB Correct answer: answer = 32
12 Correct 3 ms 2556 KB Correct answer: answer = 130050
13 Correct 4 ms 2556 KB Correct answer: answer = 5110
14 Correct 3 ms 2556 KB Correct answer: answer = 2626
15 Correct 5 ms 2556 KB Correct answer: answer = 796
16 Correct 3 ms 2556 KB Correct answer: answer = 7580
17 Correct 5 ms 2556 KB Correct answer: answer = 1904
18 Correct 2 ms 2556 KB Correct answer: answer = 996004
19 Correct 3 ms 2556 KB Correct answer: answer = 38817
20 Correct 4 ms 2556 KB Correct answer: answer = 4096
21 Correct 3 ms 2556 KB Correct answer: answer = 1
22 Correct 3 ms 2556 KB Correct answer: answer = 1
23 Correct 5 ms 2556 KB Correct answer: answer = 2040
24 Correct 3 ms 2556 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 3 ms 484 KB Correct answer: answer = 4
3 Correct 2 ms 484 KB Correct answer: answer = 4
4 Correct 3 ms 484 KB Correct answer: answer = 12
5 Correct 2 ms 560 KB Correct answer: answer = 52
6 Correct 2 ms 588 KB Correct answer: answer = 210
7 Correct 2 ms 588 KB Correct answer: answer = 88
8 Correct 3 ms 588 KB Correct answer: answer = 7696
9 Correct 2 ms 588 KB Correct answer: answer = 1
10 Correct 3 ms 628 KB Correct answer: answer = 2374
11 Correct 2 ms 628 KB Correct answer: answer = 9502
12 Correct 2 ms 628 KB Correct answer: answer = 49
13 Correct 2 ms 644 KB Correct answer: answer = 151
14 Correct 2 ms 644 KB Correct answer: answer = 7550
15 Correct 3 ms 644 KB Correct answer: answer = 7220
16 Correct 3 ms 644 KB Correct answer: answer = 7550
17 Correct 3 ms 644 KB Correct answer: answer = 10000
18 Correct 2 ms 644 KB Correct answer: answer = 10000
19 Correct 2 ms 644 KB Correct answer: answer = 624
20 Correct 2 ms 644 KB Correct answer: answer = 10000
21 Correct 3 ms 644 KB Correct answer: answer = 1
22 Correct 3 ms 644 KB Correct answer: answer = 4
23 Correct 3 ms 644 KB Correct answer: answer = 1
24 Correct 2 ms 644 KB Correct answer: answer = 5
25 Correct 3 ms 644 KB Correct answer: answer = 41
26 Correct 2 ms 644 KB Correct answer: answer = 71923
27 Correct 2 ms 644 KB Correct answer: answer = 77137
28 Correct 7 ms 1404 KB Correct answer: answer = 764
29 Correct 2 ms 1404 KB Correct answer: answer = 250000
30 Correct 14 ms 2556 KB Correct answer: answer = 500
31 Correct 2 ms 2556 KB Correct answer: answer = 32
32 Correct 3 ms 2556 KB Correct answer: answer = 130050
33 Correct 4 ms 2556 KB Correct answer: answer = 5110
34 Correct 3 ms 2556 KB Correct answer: answer = 2626
35 Correct 5 ms 2556 KB Correct answer: answer = 796
36 Correct 3 ms 2556 KB Correct answer: answer = 7580
37 Correct 5 ms 2556 KB Correct answer: answer = 1904
38 Correct 2 ms 2556 KB Correct answer: answer = 996004
39 Correct 3 ms 2556 KB Correct answer: answer = 38817
40 Correct 4 ms 2556 KB Correct answer: answer = 4096
41 Correct 3 ms 2556 KB Correct answer: answer = 1
42 Correct 3 ms 2556 KB Correct answer: answer = 1
43 Correct 5 ms 2556 KB Correct answer: answer = 2040
44 Correct 3 ms 2556 KB Correct answer: answer = 2
45 Correct 2 ms 2556 KB Correct answer: answer = 4
46 Correct 2 ms 2556 KB Correct answer: answer = 9
47 Correct 3 ms 2556 KB Correct answer: answer = 9
48 Correct 2 ms 2556 KB Correct answer: answer = 21
49 Correct 1 ms 2556 KB Correct answer: answer = 71
50 Correct 2 ms 2556 KB Correct answer: answer = 77
51 Correct 3 ms 2556 KB Correct answer: answer = 400
52 Correct 3 ms 2556 KB Correct answer: answer = 996004
53 Correct 3 ms 2556 KB Correct answer: answer = 997310
54 Correct 3 ms 2556 KB Correct answer: answer = 990781
55 Correct 3 ms 2556 KB Correct answer: answer = 996545
56 Correct 3 ms 2556 KB Correct answer: answer = 484
57 Correct 3 ms 2556 KB Correct answer: answer = 484
58 Correct 3 ms 2556 KB Correct answer: answer = 63501
59 Correct 4 ms 2556 KB Correct answer: answer = 323501
60 Correct 4 ms 2556 KB Correct answer: answer = 752500
61 Correct 3 ms 2556 KB Correct answer: answer = 761480
62 Correct 5 ms 2556 KB Correct answer: answer = 758932
63 Correct 2 ms 2556 KB Correct answer: answer = 1000000
64 Correct 16 ms 2556 KB Correct answer: answer = 750500
65 Correct 2 ms 2556 KB Correct answer: answer = 1000000
66 Correct 3 ms 2556 KB Correct answer: answer = 250000
67 Correct 3 ms 2556 KB Correct answer: answer = 250000
68 Correct 3 ms 2556 KB Correct answer: answer = 1000000
69 Correct 3 ms 2556 KB Correct answer: answer = 994009
70 Correct 3 ms 2556 KB Correct answer: answer = 59315
71 Correct 4 ms 2556 KB Correct answer: answer = 25454
72 Correct 4 ms 2556 KB Correct answer: answer = 1504
73 Correct 3 ms 2556 KB Correct answer: answer = 37486
74 Correct 4 ms 2556 KB Correct answer: answer = 4284
75 Correct 3 ms 2556 KB Correct answer: answer = 158008
76 Correct 3 ms 2556 KB Correct answer: answer = 51860
77 Correct 2 ms 2556 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 3 ms 484 KB Correct answer: answer = 4
3 Correct 2 ms 484 KB Correct answer: answer = 4
4 Correct 3 ms 484 KB Correct answer: answer = 12
5 Correct 2 ms 560 KB Correct answer: answer = 52
6 Correct 2 ms 588 KB Correct answer: answer = 210
7 Correct 2 ms 588 KB Correct answer: answer = 88
8 Correct 3 ms 588 KB Correct answer: answer = 7696
9 Correct 2 ms 588 KB Correct answer: answer = 1
10 Correct 3 ms 628 KB Correct answer: answer = 2374
11 Correct 2 ms 628 KB Correct answer: answer = 9502
12 Correct 2 ms 628 KB Correct answer: answer = 49
13 Correct 2 ms 644 KB Correct answer: answer = 151
14 Correct 2 ms 644 KB Correct answer: answer = 7550
15 Correct 3 ms 644 KB Correct answer: answer = 7220
16 Correct 3 ms 644 KB Correct answer: answer = 7550
17 Correct 3 ms 644 KB Correct answer: answer = 10000
18 Correct 2 ms 644 KB Correct answer: answer = 10000
19 Correct 2 ms 644 KB Correct answer: answer = 624
20 Correct 2 ms 644 KB Correct answer: answer = 10000
21 Correct 3 ms 644 KB Correct answer: answer = 1
22 Correct 3 ms 644 KB Correct answer: answer = 4
23 Correct 3 ms 644 KB Correct answer: answer = 1
24 Correct 2 ms 644 KB Correct answer: answer = 5
25 Correct 3 ms 644 KB Correct answer: answer = 41
26 Correct 2 ms 644 KB Correct answer: answer = 71923
27 Correct 2 ms 644 KB Correct answer: answer = 77137
28 Correct 7 ms 1404 KB Correct answer: answer = 764
29 Correct 2 ms 1404 KB Correct answer: answer = 250000
30 Correct 14 ms 2556 KB Correct answer: answer = 500
31 Correct 2 ms 2556 KB Correct answer: answer = 32
32 Correct 3 ms 2556 KB Correct answer: answer = 130050
33 Correct 4 ms 2556 KB Correct answer: answer = 5110
34 Correct 3 ms 2556 KB Correct answer: answer = 2626
35 Correct 5 ms 2556 KB Correct answer: answer = 796
36 Correct 3 ms 2556 KB Correct answer: answer = 7580
37 Correct 5 ms 2556 KB Correct answer: answer = 1904
38 Correct 2 ms 2556 KB Correct answer: answer = 996004
39 Correct 3 ms 2556 KB Correct answer: answer = 38817
40 Correct 4 ms 2556 KB Correct answer: answer = 4096
41 Correct 3 ms 2556 KB Correct answer: answer = 1
42 Correct 3 ms 2556 KB Correct answer: answer = 1
43 Correct 5 ms 2556 KB Correct answer: answer = 2040
44 Correct 3 ms 2556 KB Correct answer: answer = 2
45 Correct 2 ms 2556 KB Correct answer: answer = 4
46 Correct 2 ms 2556 KB Correct answer: answer = 9
47 Correct 3 ms 2556 KB Correct answer: answer = 9
48 Correct 2 ms 2556 KB Correct answer: answer = 21
49 Correct 1 ms 2556 KB Correct answer: answer = 71
50 Correct 2 ms 2556 KB Correct answer: answer = 77
51 Correct 3 ms 2556 KB Correct answer: answer = 400
52 Correct 3 ms 2556 KB Correct answer: answer = 996004
53 Correct 3 ms 2556 KB Correct answer: answer = 997310
54 Correct 3 ms 2556 KB Correct answer: answer = 990781
55 Correct 3 ms 2556 KB Correct answer: answer = 996545
56 Correct 3 ms 2556 KB Correct answer: answer = 484
57 Correct 3 ms 2556 KB Correct answer: answer = 484
58 Correct 3 ms 2556 KB Correct answer: answer = 63501
59 Correct 4 ms 2556 KB Correct answer: answer = 323501
60 Correct 4 ms 2556 KB Correct answer: answer = 752500
61 Correct 3 ms 2556 KB Correct answer: answer = 761480
62 Correct 5 ms 2556 KB Correct answer: answer = 758932
63 Correct 2 ms 2556 KB Correct answer: answer = 1000000
64 Correct 16 ms 2556 KB Correct answer: answer = 750500
65 Correct 2 ms 2556 KB Correct answer: answer = 1000000
66 Correct 3 ms 2556 KB Correct answer: answer = 250000
67 Correct 3 ms 2556 KB Correct answer: answer = 250000
68 Correct 3 ms 2556 KB Correct answer: answer = 1000000
69 Correct 3 ms 2556 KB Correct answer: answer = 994009
70 Correct 3 ms 2556 KB Correct answer: answer = 59315
71 Correct 4 ms 2556 KB Correct answer: answer = 25454
72 Correct 4 ms 2556 KB Correct answer: answer = 1504
73 Correct 3 ms 2556 KB Correct answer: answer = 37486
74 Correct 4 ms 2556 KB Correct answer: answer = 4284
75 Correct 3 ms 2556 KB Correct answer: answer = 158008
76 Correct 3 ms 2556 KB Correct answer: answer = 51860
77 Correct 2 ms 2556 KB Correct answer: answer = 12985
78 Correct 4 ms 2556 KB Correct answer: answer = 997864126212
79 Correct 3 ms 2556 KB Correct answer: answer = 998608411647
80 Correct 6 ms 2556 KB Correct answer: answer = 995265560477
81 Correct 5 ms 2556 KB Correct answer: answer = 10125000
82 Correct 5 ms 2556 KB Correct answer: answer = 2291668
83 Correct 10 ms 2556 KB Correct answer: answer = 42388
84 Correct 45 ms 7292 KB Correct answer: answer = 10318
85 Correct 140 ms 22652 KB Correct answer: answer = 3416
86 Correct 6 ms 22652 KB Correct answer: answer = 331708193881
87 Correct 64 ms 22652 KB Correct answer: answer = 2861193756
88 Correct 502 ms 42960 KB Correct answer: answer = 114646930
89 Correct 12 ms 42960 KB Correct answer: answer = 9280921
90 Correct 66 ms 42960 KB Correct answer: answer = 999984053400
91 Correct 268 ms 42960 KB Correct answer: answer = 750935949134
92 Correct 4 ms 42960 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 42960 KB Correct answer: answer = 998762383161
94 Correct 11 ms 42960 KB Correct answer: answer = 23017412908
95 Correct 8 ms 42960 KB Correct answer: answer = 728143410622
96 Correct 3 ms 42960 KB Correct answer: answer = 2
97 Correct 6 ms 42960 KB Correct answer: answer = 1824916
98 Correct 181 ms 42960 KB Correct answer: answer = 10680029
99 Correct 83 ms 42960 KB Correct answer: answer = 18351700
100 Correct 5 ms 42960 KB Correct answer: answer = 16040026
101 Correct 6 ms 42960 KB Correct answer: answer = 253968628325
102 Correct 103 ms 42960 KB Correct answer: answer = 10267
103 Correct 598 ms 57028 KB Correct answer: answer = 2582408
104 Correct 5 ms 57028 KB Correct answer: answer = 78024964781
105 Correct 4 ms 57028 KB Correct answer: answer = 9866346457
106 Correct 7 ms 57028 KB Correct answer: answer = 3327720949
107 Correct 28 ms 57028 KB Correct answer: answer = 86064128360
108 Correct 132 ms 57028 KB Correct answer: answer = 12698259150
109 Correct 532 ms 64528 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 3 ms 484 KB Correct answer: answer = 4
3 Correct 2 ms 484 KB Correct answer: answer = 4
4 Correct 3 ms 484 KB Correct answer: answer = 12
5 Correct 2 ms 560 KB Correct answer: answer = 52
6 Correct 2 ms 588 KB Correct answer: answer = 210
7 Correct 2 ms 588 KB Correct answer: answer = 88
8 Correct 3 ms 588 KB Correct answer: answer = 7696
9 Correct 2 ms 588 KB Correct answer: answer = 1
10 Correct 3 ms 628 KB Correct answer: answer = 2374
11 Correct 2 ms 628 KB Correct answer: answer = 9502
12 Correct 2 ms 628 KB Correct answer: answer = 49
13 Correct 2 ms 644 KB Correct answer: answer = 151
14 Correct 2 ms 644 KB Correct answer: answer = 7550
15 Correct 3 ms 644 KB Correct answer: answer = 7220
16 Correct 3 ms 644 KB Correct answer: answer = 7550
17 Correct 3 ms 644 KB Correct answer: answer = 10000
18 Correct 2 ms 644 KB Correct answer: answer = 10000
19 Correct 2 ms 644 KB Correct answer: answer = 624
20 Correct 2 ms 644 KB Correct answer: answer = 10000
21 Correct 3 ms 644 KB Correct answer: answer = 1
22 Correct 3 ms 644 KB Correct answer: answer = 4
23 Correct 3 ms 644 KB Correct answer: answer = 1
24 Correct 2 ms 644 KB Correct answer: answer = 5
25 Correct 3 ms 644 KB Correct answer: answer = 41
26 Correct 2 ms 644 KB Correct answer: answer = 71923
27 Correct 2 ms 644 KB Correct answer: answer = 77137
28 Correct 7 ms 1404 KB Correct answer: answer = 764
29 Correct 2 ms 1404 KB Correct answer: answer = 250000
30 Correct 14 ms 2556 KB Correct answer: answer = 500
31 Correct 2 ms 2556 KB Correct answer: answer = 32
32 Correct 3 ms 2556 KB Correct answer: answer = 130050
33 Correct 4 ms 2556 KB Correct answer: answer = 5110
34 Correct 3 ms 2556 KB Correct answer: answer = 2626
35 Correct 5 ms 2556 KB Correct answer: answer = 796
36 Correct 3 ms 2556 KB Correct answer: answer = 7580
37 Correct 5 ms 2556 KB Correct answer: answer = 1904
38 Correct 2 ms 2556 KB Correct answer: answer = 996004
39 Correct 3 ms 2556 KB Correct answer: answer = 38817
40 Correct 4 ms 2556 KB Correct answer: answer = 4096
41 Correct 3 ms 2556 KB Correct answer: answer = 1
42 Correct 3 ms 2556 KB Correct answer: answer = 1
43 Correct 5 ms 2556 KB Correct answer: answer = 2040
44 Correct 3 ms 2556 KB Correct answer: answer = 2
45 Correct 2 ms 2556 KB Correct answer: answer = 4
46 Correct 2 ms 2556 KB Correct answer: answer = 9
47 Correct 3 ms 2556 KB Correct answer: answer = 9
48 Correct 2 ms 2556 KB Correct answer: answer = 21
49 Correct 1 ms 2556 KB Correct answer: answer = 71
50 Correct 2 ms 2556 KB Correct answer: answer = 77
51 Correct 3 ms 2556 KB Correct answer: answer = 400
52 Correct 3 ms 2556 KB Correct answer: answer = 996004
53 Correct 3 ms 2556 KB Correct answer: answer = 997310
54 Correct 3 ms 2556 KB Correct answer: answer = 990781
55 Correct 3 ms 2556 KB Correct answer: answer = 996545
56 Correct 3 ms 2556 KB Correct answer: answer = 484
57 Correct 3 ms 2556 KB Correct answer: answer = 484
58 Correct 3 ms 2556 KB Correct answer: answer = 63501
59 Correct 4 ms 2556 KB Correct answer: answer = 323501
60 Correct 4 ms 2556 KB Correct answer: answer = 752500
61 Correct 3 ms 2556 KB Correct answer: answer = 761480
62 Correct 5 ms 2556 KB Correct answer: answer = 758932
63 Correct 2 ms 2556 KB Correct answer: answer = 1000000
64 Correct 16 ms 2556 KB Correct answer: answer = 750500
65 Correct 2 ms 2556 KB Correct answer: answer = 1000000
66 Correct 3 ms 2556 KB Correct answer: answer = 250000
67 Correct 3 ms 2556 KB Correct answer: answer = 250000
68 Correct 3 ms 2556 KB Correct answer: answer = 1000000
69 Correct 3 ms 2556 KB Correct answer: answer = 994009
70 Correct 3 ms 2556 KB Correct answer: answer = 59315
71 Correct 4 ms 2556 KB Correct answer: answer = 25454
72 Correct 4 ms 2556 KB Correct answer: answer = 1504
73 Correct 3 ms 2556 KB Correct answer: answer = 37486
74 Correct 4 ms 2556 KB Correct answer: answer = 4284
75 Correct 3 ms 2556 KB Correct answer: answer = 158008
76 Correct 3 ms 2556 KB Correct answer: answer = 51860
77 Correct 2 ms 2556 KB Correct answer: answer = 12985
78 Correct 4 ms 2556 KB Correct answer: answer = 997864126212
79 Correct 3 ms 2556 KB Correct answer: answer = 998608411647
80 Correct 6 ms 2556 KB Correct answer: answer = 995265560477
81 Correct 5 ms 2556 KB Correct answer: answer = 10125000
82 Correct 5 ms 2556 KB Correct answer: answer = 2291668
83 Correct 10 ms 2556 KB Correct answer: answer = 42388
84 Correct 45 ms 7292 KB Correct answer: answer = 10318
85 Correct 140 ms 22652 KB Correct answer: answer = 3416
86 Correct 6 ms 22652 KB Correct answer: answer = 331708193881
87 Correct 64 ms 22652 KB Correct answer: answer = 2861193756
88 Correct 502 ms 42960 KB Correct answer: answer = 114646930
89 Correct 12 ms 42960 KB Correct answer: answer = 9280921
90 Correct 66 ms 42960 KB Correct answer: answer = 999984053400
91 Correct 268 ms 42960 KB Correct answer: answer = 750935949134
92 Correct 4 ms 42960 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 42960 KB Correct answer: answer = 998762383161
94 Correct 11 ms 42960 KB Correct answer: answer = 23017412908
95 Correct 8 ms 42960 KB Correct answer: answer = 728143410622
96 Correct 3 ms 42960 KB Correct answer: answer = 2
97 Correct 6 ms 42960 KB Correct answer: answer = 1824916
98 Correct 181 ms 42960 KB Correct answer: answer = 10680029
99 Correct 83 ms 42960 KB Correct answer: answer = 18351700
100 Correct 5 ms 42960 KB Correct answer: answer = 16040026
101 Correct 6 ms 42960 KB Correct answer: answer = 253968628325
102 Correct 103 ms 42960 KB Correct answer: answer = 10267
103 Correct 598 ms 57028 KB Correct answer: answer = 2582408
104 Correct 5 ms 57028 KB Correct answer: answer = 78024964781
105 Correct 4 ms 57028 KB Correct answer: answer = 9866346457
106 Correct 7 ms 57028 KB Correct answer: answer = 3327720949
107 Correct 28 ms 57028 KB Correct answer: answer = 86064128360
108 Correct 132 ms 57028 KB Correct answer: answer = 12698259150
109 Correct 532 ms 64528 KB Correct answer: answer = 1185259288
110 Correct 24 ms 64528 KB Correct answer: answer = 999889968863
111 Correct 26 ms 64528 KB Correct answer: answer = 999861384931
112 Correct 30 ms 64528 KB Correct answer: answer = 999811809929
113 Correct 25 ms 64528 KB Correct answer: answer = 999869756441
114 Correct 31 ms 64528 KB Correct answer: answer = 1700000000
115 Correct 98 ms 64528 KB Correct answer: answer = 131666670
116 Correct 11 ms 64528 KB Correct answer: answer = 89478486
117 Correct 53 ms 64528 KB Correct answer: answer = 4971040
118 Correct 88 ms 64528 KB Correct answer: answer = 2711494
119 Correct 366 ms 64528 KB Correct answer: answer = 25252530
120 Correct 220 ms 64528 KB Correct answer: answer = 62500000
121 Correct 48 ms 64528 KB Correct answer: answer = 333175097780
122 Correct 176 ms 64528 KB Correct answer: answer = 33121180179
123 Correct 687 ms 64528 KB Correct answer: answer = 9802314015
124 Correct 404 ms 64528 KB Correct answer: answer = 32567551
125 Correct 561 ms 64528 KB Correct answer: answer = 997525000000
126 Correct 334 ms 64528 KB Correct answer: answer = 752723538884
127 Correct 18 ms 64528 KB Correct answer: answer = 1000000000000
128 Correct 24 ms 64528 KB Correct answer: answer = 999978000121
129 Correct 29 ms 64528 KB Correct answer: answer = 745986144735
130 Correct 16 ms 64528 KB Correct answer: answer = 2
131 Correct 58 ms 64528 KB Correct answer: answer = 277966670
132 Correct 42 ms 64528 KB Correct answer: answer = 2500900082
133 Correct 26 ms 64528 KB Correct answer: answer = 301248349636
134 Correct 197 ms 64528 KB Correct answer: answer = 14118891
135 Correct 29 ms 64528 KB Correct answer: answer = 14384977265
136 Correct 34 ms 64528 KB Correct answer: answer = 3681368330
137 Correct 26 ms 64528 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 3 ms 484 KB Correct answer: answer = 4
3 Correct 2 ms 484 KB Correct answer: answer = 4
4 Correct 3 ms 484 KB Correct answer: answer = 12
5 Correct 2 ms 560 KB Correct answer: answer = 52
6 Correct 2 ms 588 KB Correct answer: answer = 210
7 Correct 2 ms 588 KB Correct answer: answer = 88
8 Correct 3 ms 588 KB Correct answer: answer = 7696
9 Correct 2 ms 588 KB Correct answer: answer = 1
10 Correct 3 ms 628 KB Correct answer: answer = 2374
11 Correct 2 ms 628 KB Correct answer: answer = 9502
12 Correct 2 ms 628 KB Correct answer: answer = 49
13 Correct 2 ms 644 KB Correct answer: answer = 151
14 Correct 2 ms 644 KB Correct answer: answer = 7550
15 Correct 3 ms 644 KB Correct answer: answer = 7220
16 Correct 3 ms 644 KB Correct answer: answer = 7550
17 Correct 3 ms 644 KB Correct answer: answer = 10000
18 Correct 2 ms 644 KB Correct answer: answer = 10000
19 Correct 2 ms 644 KB Correct answer: answer = 624
20 Correct 2 ms 644 KB Correct answer: answer = 10000
21 Correct 3 ms 644 KB Correct answer: answer = 1
22 Correct 3 ms 644 KB Correct answer: answer = 4
23 Correct 3 ms 644 KB Correct answer: answer = 1
24 Correct 2 ms 644 KB Correct answer: answer = 5
25 Correct 3 ms 644 KB Correct answer: answer = 41
26 Correct 2 ms 644 KB Correct answer: answer = 71923
27 Correct 2 ms 644 KB Correct answer: answer = 77137
28 Correct 7 ms 1404 KB Correct answer: answer = 764
29 Correct 2 ms 1404 KB Correct answer: answer = 250000
30 Correct 14 ms 2556 KB Correct answer: answer = 500
31 Correct 2 ms 2556 KB Correct answer: answer = 32
32 Correct 3 ms 2556 KB Correct answer: answer = 130050
33 Correct 4 ms 2556 KB Correct answer: answer = 5110
34 Correct 3 ms 2556 KB Correct answer: answer = 2626
35 Correct 5 ms 2556 KB Correct answer: answer = 796
36 Correct 3 ms 2556 KB Correct answer: answer = 7580
37 Correct 5 ms 2556 KB Correct answer: answer = 1904
38 Correct 2 ms 2556 KB Correct answer: answer = 996004
39 Correct 3 ms 2556 KB Correct answer: answer = 38817
40 Correct 4 ms 2556 KB Correct answer: answer = 4096
41 Correct 3 ms 2556 KB Correct answer: answer = 1
42 Correct 3 ms 2556 KB Correct answer: answer = 1
43 Correct 5 ms 2556 KB Correct answer: answer = 2040
44 Correct 3 ms 2556 KB Correct answer: answer = 2
45 Correct 2 ms 2556 KB Correct answer: answer = 4
46 Correct 2 ms 2556 KB Correct answer: answer = 9
47 Correct 3 ms 2556 KB Correct answer: answer = 9
48 Correct 2 ms 2556 KB Correct answer: answer = 21
49 Correct 1 ms 2556 KB Correct answer: answer = 71
50 Correct 2 ms 2556 KB Correct answer: answer = 77
51 Correct 3 ms 2556 KB Correct answer: answer = 400
52 Correct 3 ms 2556 KB Correct answer: answer = 996004
53 Correct 3 ms 2556 KB Correct answer: answer = 997310
54 Correct 3 ms 2556 KB Correct answer: answer = 990781
55 Correct 3 ms 2556 KB Correct answer: answer = 996545
56 Correct 3 ms 2556 KB Correct answer: answer = 484
57 Correct 3 ms 2556 KB Correct answer: answer = 484
58 Correct 3 ms 2556 KB Correct answer: answer = 63501
59 Correct 4 ms 2556 KB Correct answer: answer = 323501
60 Correct 4 ms 2556 KB Correct answer: answer = 752500
61 Correct 3 ms 2556 KB Correct answer: answer = 761480
62 Correct 5 ms 2556 KB Correct answer: answer = 758932
63 Correct 2 ms 2556 KB Correct answer: answer = 1000000
64 Correct 16 ms 2556 KB Correct answer: answer = 750500
65 Correct 2 ms 2556 KB Correct answer: answer = 1000000
66 Correct 3 ms 2556 KB Correct answer: answer = 250000
67 Correct 3 ms 2556 KB Correct answer: answer = 250000
68 Correct 3 ms 2556 KB Correct answer: answer = 1000000
69 Correct 3 ms 2556 KB Correct answer: answer = 994009
70 Correct 3 ms 2556 KB Correct answer: answer = 59315
71 Correct 4 ms 2556 KB Correct answer: answer = 25454
72 Correct 4 ms 2556 KB Correct answer: answer = 1504
73 Correct 3 ms 2556 KB Correct answer: answer = 37486
74 Correct 4 ms 2556 KB Correct answer: answer = 4284
75 Correct 3 ms 2556 KB Correct answer: answer = 158008
76 Correct 3 ms 2556 KB Correct answer: answer = 51860
77 Correct 2 ms 2556 KB Correct answer: answer = 12985
78 Correct 4 ms 2556 KB Correct answer: answer = 997864126212
79 Correct 3 ms 2556 KB Correct answer: answer = 998608411647
80 Correct 6 ms 2556 KB Correct answer: answer = 995265560477
81 Correct 5 ms 2556 KB Correct answer: answer = 10125000
82 Correct 5 ms 2556 KB Correct answer: answer = 2291668
83 Correct 10 ms 2556 KB Correct answer: answer = 42388
84 Correct 45 ms 7292 KB Correct answer: answer = 10318
85 Correct 140 ms 22652 KB Correct answer: answer = 3416
86 Correct 6 ms 22652 KB Correct answer: answer = 331708193881
87 Correct 64 ms 22652 KB Correct answer: answer = 2861193756
88 Correct 502 ms 42960 KB Correct answer: answer = 114646930
89 Correct 12 ms 42960 KB Correct answer: answer = 9280921
90 Correct 66 ms 42960 KB Correct answer: answer = 999984053400
91 Correct 268 ms 42960 KB Correct answer: answer = 750935949134
92 Correct 4 ms 42960 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 42960 KB Correct answer: answer = 998762383161
94 Correct 11 ms 42960 KB Correct answer: answer = 23017412908
95 Correct 8 ms 42960 KB Correct answer: answer = 728143410622
96 Correct 3 ms 42960 KB Correct answer: answer = 2
97 Correct 6 ms 42960 KB Correct answer: answer = 1824916
98 Correct 181 ms 42960 KB Correct answer: answer = 10680029
99 Correct 83 ms 42960 KB Correct answer: answer = 18351700
100 Correct 5 ms 42960 KB Correct answer: answer = 16040026
101 Correct 6 ms 42960 KB Correct answer: answer = 253968628325
102 Correct 103 ms 42960 KB Correct answer: answer = 10267
103 Correct 598 ms 57028 KB Correct answer: answer = 2582408
104 Correct 5 ms 57028 KB Correct answer: answer = 78024964781
105 Correct 4 ms 57028 KB Correct answer: answer = 9866346457
106 Correct 7 ms 57028 KB Correct answer: answer = 3327720949
107 Correct 28 ms 57028 KB Correct answer: answer = 86064128360
108 Correct 132 ms 57028 KB Correct answer: answer = 12698259150
109 Correct 532 ms 64528 KB Correct answer: answer = 1185259288
110 Correct 24 ms 64528 KB Correct answer: answer = 999889968863
111 Correct 26 ms 64528 KB Correct answer: answer = 999861384931
112 Correct 30 ms 64528 KB Correct answer: answer = 999811809929
113 Correct 25 ms 64528 KB Correct answer: answer = 999869756441
114 Correct 31 ms 64528 KB Correct answer: answer = 1700000000
115 Correct 98 ms 64528 KB Correct answer: answer = 131666670
116 Correct 11 ms 64528 KB Correct answer: answer = 89478486
117 Correct 53 ms 64528 KB Correct answer: answer = 4971040
118 Correct 88 ms 64528 KB Correct answer: answer = 2711494
119 Correct 366 ms 64528 KB Correct answer: answer = 25252530
120 Correct 220 ms 64528 KB Correct answer: answer = 62500000
121 Correct 48 ms 64528 KB Correct answer: answer = 333175097780
122 Correct 176 ms 64528 KB Correct answer: answer = 33121180179
123 Correct 687 ms 64528 KB Correct answer: answer = 9802314015
124 Correct 404 ms 64528 KB Correct answer: answer = 32567551
125 Correct 561 ms 64528 KB Correct answer: answer = 997525000000
126 Correct 334 ms 64528 KB Correct answer: answer = 752723538884
127 Correct 18 ms 64528 KB Correct answer: answer = 1000000000000
128 Correct 24 ms 64528 KB Correct answer: answer = 999978000121
129 Correct 29 ms 64528 KB Correct answer: answer = 745986144735
130 Correct 16 ms 64528 KB Correct answer: answer = 2
131 Correct 58 ms 64528 KB Correct answer: answer = 277966670
132 Correct 42 ms 64528 KB Correct answer: answer = 2500900082
133 Correct 26 ms 64528 KB Correct answer: answer = 301248349636
134 Correct 197 ms 64528 KB Correct answer: answer = 14118891
135 Correct 29 ms 64528 KB Correct answer: answer = 14384977265
136 Correct 34 ms 64528 KB Correct answer: answer = 3681368330
137 Correct 26 ms 64528 KB Correct answer: answer = 2720316816
138 Correct 56 ms 64528 KB Correct answer: answer = 999976000144
139 Correct 46 ms 64528 KB Correct answer: answer = 999856102410
140 Correct 61 ms 64528 KB Correct answer: answer = 999958401531
141 Correct 61 ms 64528 KB Correct answer: answer = 999769649944
142 Correct 100 ms 64528 KB Correct answer: answer = 999874525918
143 Correct 66 ms 64528 KB Correct answer: answer = 6050000000
144 Correct 108 ms 64528 KB Correct answer: answer = 1112500000
145 Correct 39 ms 64528 KB Correct answer: answer = 4294967296
146 Correct 393 ms 64528 KB Correct answer: answer = 87652406
147 Execution timed out 2074 ms 385036 KB Time limit exceeded
148 Halted 0 ms 0 KB -