Submission #429339

# Submission time Handle Problem Language Result Execution time Memory
429339 2021-06-15T20:56:17 Z JeanBombeur Aliens (IOI16_aliens) C++17
100 / 100
143 ms 6800 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
 
//    <|°_°|>
 
const int MAX_POINTS = (100 * 1000);
const int LOG = (40);
 
struct droite {
    long long pente, cst;
    int prix;
};
 
pair <long long, long long> Points[MAX_POINTS];
pair <int, int> Aliens[MAX_POINTS];
 
droite Deque[MAX_POINTS];
int deb = 0, fin = 0;
 
int nbPoints = 0;

bool Compare(pair <int, int> a, pair <int, int> b) {
    if (a.first != b.first)
        return a.first < b.first;
    return a.second > b.second;
}

void Insert(droite a) {
    while (fin > deb + 1 && pair<long long, int>((a.cst - Deque[fin - 1].cst) * (Deque[fin - 2].pente - Deque[fin - 1].pente), a.prix) < pair<long long, int>((Deque[fin - 1].pente - a.pente) * (Deque[fin - 1].cst - Deque[fin - 2].cst), Deque[fin - 1].prix))
        fin --;
    Deque[fin ++] = a;
    return;
}
 
pair <long long, int> GetMin(long long absc) {
    while (fin > deb + 1 && pair<long long, int>(absc * Deque[deb].pente + Deque[deb].cst, Deque[deb].prix) > pair<long long, int>(absc * Deque[deb + 1].pente + Deque[deb + 1].cst, Deque[deb + 1].prix))
        deb ++;
    return {Deque[deb].pente * absc + Deque[deb].cst, Deque[deb].prix};
}
 
pair <long long, int> FindDP(long long lambda) {
    deb = 0, fin = 0;
    pair <long long, int> DP = {0LL, 0};
    Insert({- 2 * Points[0].first, Points[0].first * Points[0].first, 0});
    for (int i = 0; i < nbPoints; i ++)
    {
        DP = GetMin(Points[i].second);
        DP.first += Points[i].second * Points[i].second + lambda;
        DP.second ++;
        if (i + 1 < nbPoints)
        {
            long long d1 = max(0LL, Points[i].second - Points[i + 1].first), d2 = Points[i + 1].first;
            Insert({-2 * d2, DP.first - d1 * d1 + d2 * d2, DP.second});
        }
    }
    return DP;
}
 
long long take_photos(int nbAliens, int tailleMax, int nbPhotos, vector<int> Lignes, vector<int> Colonnes) {
    
    tailleMax ++;
    
    for (int i = 0; i < nbAliens; i ++)
    {
        if (Lignes[i] > Colonnes[i])
            swap(Lignes[i], Colonnes[i]);
        Aliens[i] = {Lignes[i], ++ Colonnes[i]};
    }
    sort(Aliens, Aliens + nbAliens, Compare);
    
    for (int i = 0; i < nbAliens; i ++)
    {
        if (nbPoints == 0 || Aliens[i].second > (int)Points[nbPoints - 1].second)
            Points[nbPoints ++] = Aliens[i];
    }
    
    long long lambda = -1;
    pair <long long, int> DP;

    for (long long i = (1LL << LOG); i > 0; i /= 2)
    {
        DP = FindDP(lambda + i);
        if (DP.second > nbPhotos)
            lambda += i;
    }
    DP = FindDP(++ lambda);
    return DP.first - lambda * nbPhotos;
}
# 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 300 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 296 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 300 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 296 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 304 KB Correct answer: answer = 77137
8 Correct 1 ms 332 KB Correct answer: answer = 764
9 Correct 1 ms 304 KB Correct answer: answer = 250000
10 Correct 1 ms 332 KB Correct answer: answer = 500
11 Correct 1 ms 204 KB Correct answer: answer = 32
12 Correct 1 ms 332 KB Correct answer: answer = 130050
13 Correct 1 ms 332 KB Correct answer: answer = 5110
14 Correct 1 ms 204 KB Correct answer: answer = 2626
15 Correct 1 ms 204 KB Correct answer: answer = 796
16 Correct 1 ms 332 KB Correct answer: answer = 7580
17 Correct 1 ms 332 KB Correct answer: answer = 1904
18 Correct 1 ms 332 KB Correct answer: answer = 996004
19 Correct 1 ms 204 KB Correct answer: answer = 38817
20 Correct 1 ms 332 KB Correct answer: answer = 4096
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 1
23 Correct 1 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 300 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 296 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 300 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 296 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 304 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 304 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 1 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 204 KB Correct answer: answer = 400
52 Correct 1 ms 304 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 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 300 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 1 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 332 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 300 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 296 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 300 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 296 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 304 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 304 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 1 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 204 KB Correct answer: answer = 400
52 Correct 1 ms 304 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 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 300 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 1 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 332 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 2 ms 360 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 2 ms 332 KB Correct answer: answer = 995265560477
81 Correct 6 ms 460 KB Correct answer: answer = 10125000
82 Correct 5 ms 460 KB Correct answer: answer = 2291668
83 Correct 3 ms 332 KB Correct answer: answer = 42388
84 Correct 3 ms 332 KB Correct answer: answer = 10318
85 Correct 4 ms 440 KB Correct answer: answer = 3416
86 Correct 6 ms 464 KB Correct answer: answer = 331708193881
87 Correct 7 ms 460 KB Correct answer: answer = 2861193756
88 Correct 7 ms 460 KB Correct answer: answer = 114646930
89 Correct 6 ms 460 KB Correct answer: answer = 9280921
90 Correct 7 ms 460 KB Correct answer: answer = 999984053400
91 Correct 7 ms 540 KB Correct answer: answer = 750935949134
92 Correct 2 ms 432 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 436 KB Correct answer: answer = 998762383161
94 Correct 6 ms 508 KB Correct answer: answer = 23017412908
95 Correct 2 ms 332 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 5 ms 460 KB Correct answer: answer = 1824916
98 Correct 6 ms 460 KB Correct answer: answer = 10680029
99 Correct 6 ms 460 KB Correct answer: answer = 18351700
100 Correct 5 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 332 KB Correct answer: answer = 253968628325
102 Correct 3 ms 332 KB Correct answer: answer = 10267
103 Correct 7 ms 452 KB Correct answer: answer = 2582408
104 Correct 2 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 3 ms 332 KB Correct answer: answer = 3327720949
107 Correct 2 ms 332 KB Correct answer: answer = 86064128360
108 Correct 3 ms 460 KB Correct answer: answer = 12698259150
109 Correct 5 ms 460 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 300 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 296 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 300 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 296 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 304 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 304 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 1 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 204 KB Correct answer: answer = 400
52 Correct 1 ms 304 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 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 300 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 1 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 332 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 2 ms 360 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 2 ms 332 KB Correct answer: answer = 995265560477
81 Correct 6 ms 460 KB Correct answer: answer = 10125000
82 Correct 5 ms 460 KB Correct answer: answer = 2291668
83 Correct 3 ms 332 KB Correct answer: answer = 42388
84 Correct 3 ms 332 KB Correct answer: answer = 10318
85 Correct 4 ms 440 KB Correct answer: answer = 3416
86 Correct 6 ms 464 KB Correct answer: answer = 331708193881
87 Correct 7 ms 460 KB Correct answer: answer = 2861193756
88 Correct 7 ms 460 KB Correct answer: answer = 114646930
89 Correct 6 ms 460 KB Correct answer: answer = 9280921
90 Correct 7 ms 460 KB Correct answer: answer = 999984053400
91 Correct 7 ms 540 KB Correct answer: answer = 750935949134
92 Correct 2 ms 432 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 436 KB Correct answer: answer = 998762383161
94 Correct 6 ms 508 KB Correct answer: answer = 23017412908
95 Correct 2 ms 332 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 5 ms 460 KB Correct answer: answer = 1824916
98 Correct 6 ms 460 KB Correct answer: answer = 10680029
99 Correct 6 ms 460 KB Correct answer: answer = 18351700
100 Correct 5 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 332 KB Correct answer: answer = 253968628325
102 Correct 3 ms 332 KB Correct answer: answer = 10267
103 Correct 7 ms 452 KB Correct answer: answer = 2582408
104 Correct 2 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 3 ms 332 KB Correct answer: answer = 3327720949
107 Correct 2 ms 332 KB Correct answer: answer = 86064128360
108 Correct 3 ms 460 KB Correct answer: answer = 12698259150
109 Correct 5 ms 460 KB Correct answer: answer = 1185259288
110 Correct 19 ms 1632 KB Correct answer: answer = 999889968863
111 Correct 18 ms 1672 KB Correct answer: answer = 999861384931
112 Correct 19 ms 1648 KB Correct answer: answer = 999811809929
113 Correct 19 ms 1612 KB Correct answer: answer = 999869756441
114 Correct 64 ms 2888 KB Correct answer: answer = 1700000000
115 Correct 63 ms 3392 KB Correct answer: answer = 131666670
116 Correct 20 ms 1228 KB Correct answer: answer = 89478486
117 Correct 21 ms 1396 KB Correct answer: answer = 4971040
118 Correct 20 ms 1436 KB Correct answer: answer = 2711494
119 Correct 62 ms 3576 KB Correct answer: answer = 25252530
120 Correct 62 ms 3536 KB Correct answer: answer = 62500000
121 Correct 77 ms 2436 KB Correct answer: answer = 333175097780
122 Correct 71 ms 2456 KB Correct answer: answer = 33121180179
123 Correct 71 ms 2472 KB Correct answer: answer = 9802314015
124 Correct 63 ms 3692 KB Correct answer: answer = 32567551
125 Correct 62 ms 3496 KB Correct answer: answer = 997525000000
126 Correct 69 ms 2396 KB Correct answer: answer = 752723538884
127 Correct 14 ms 1668 KB Correct answer: answer = 1000000000000
128 Correct 19 ms 1600 KB Correct answer: answer = 999978000121
129 Correct 20 ms 1608 KB Correct answer: answer = 745986144735
130 Correct 12 ms 1484 KB Correct answer: answer = 2
131 Correct 64 ms 3328 KB Correct answer: answer = 277966670
132 Correct 64 ms 2988 KB Correct answer: answer = 2500900082
133 Correct 24 ms 1748 KB Correct answer: answer = 301248349636
134 Correct 37 ms 1612 KB Correct answer: answer = 14118891
135 Correct 19 ms 1660 KB Correct answer: answer = 14384977265
136 Correct 19 ms 1688 KB Correct answer: answer = 3681368330
137 Correct 19 ms 1688 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 300 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 296 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 300 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 296 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 304 KB Correct answer: answer = 77137
28 Correct 1 ms 332 KB Correct answer: answer = 764
29 Correct 1 ms 304 KB Correct answer: answer = 250000
30 Correct 1 ms 332 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 332 KB Correct answer: answer = 5110
34 Correct 1 ms 204 KB Correct answer: answer = 2626
35 Correct 1 ms 204 KB Correct answer: answer = 796
36 Correct 1 ms 332 KB Correct answer: answer = 7580
37 Correct 1 ms 332 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 1 ms 332 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 1 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 204 KB Correct answer: answer = 400
52 Correct 1 ms 304 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 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 1 ms 300 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 1 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 332 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 2 ms 360 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 2 ms 332 KB Correct answer: answer = 995265560477
81 Correct 6 ms 460 KB Correct answer: answer = 10125000
82 Correct 5 ms 460 KB Correct answer: answer = 2291668
83 Correct 3 ms 332 KB Correct answer: answer = 42388
84 Correct 3 ms 332 KB Correct answer: answer = 10318
85 Correct 4 ms 440 KB Correct answer: answer = 3416
86 Correct 6 ms 464 KB Correct answer: answer = 331708193881
87 Correct 7 ms 460 KB Correct answer: answer = 2861193756
88 Correct 7 ms 460 KB Correct answer: answer = 114646930
89 Correct 6 ms 460 KB Correct answer: answer = 9280921
90 Correct 7 ms 460 KB Correct answer: answer = 999984053400
91 Correct 7 ms 540 KB Correct answer: answer = 750935949134
92 Correct 2 ms 432 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 436 KB Correct answer: answer = 998762383161
94 Correct 6 ms 508 KB Correct answer: answer = 23017412908
95 Correct 2 ms 332 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 5 ms 460 KB Correct answer: answer = 1824916
98 Correct 6 ms 460 KB Correct answer: answer = 10680029
99 Correct 6 ms 460 KB Correct answer: answer = 18351700
100 Correct 5 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 332 KB Correct answer: answer = 253968628325
102 Correct 3 ms 332 KB Correct answer: answer = 10267
103 Correct 7 ms 452 KB Correct answer: answer = 2582408
104 Correct 2 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 3 ms 332 KB Correct answer: answer = 3327720949
107 Correct 2 ms 332 KB Correct answer: answer = 86064128360
108 Correct 3 ms 460 KB Correct answer: answer = 12698259150
109 Correct 5 ms 460 KB Correct answer: answer = 1185259288
110 Correct 19 ms 1632 KB Correct answer: answer = 999889968863
111 Correct 18 ms 1672 KB Correct answer: answer = 999861384931
112 Correct 19 ms 1648 KB Correct answer: answer = 999811809929
113 Correct 19 ms 1612 KB Correct answer: answer = 999869756441
114 Correct 64 ms 2888 KB Correct answer: answer = 1700000000
115 Correct 63 ms 3392 KB Correct answer: answer = 131666670
116 Correct 20 ms 1228 KB Correct answer: answer = 89478486
117 Correct 21 ms 1396 KB Correct answer: answer = 4971040
118 Correct 20 ms 1436 KB Correct answer: answer = 2711494
119 Correct 62 ms 3576 KB Correct answer: answer = 25252530
120 Correct 62 ms 3536 KB Correct answer: answer = 62500000
121 Correct 77 ms 2436 KB Correct answer: answer = 333175097780
122 Correct 71 ms 2456 KB Correct answer: answer = 33121180179
123 Correct 71 ms 2472 KB Correct answer: answer = 9802314015
124 Correct 63 ms 3692 KB Correct answer: answer = 32567551
125 Correct 62 ms 3496 KB Correct answer: answer = 997525000000
126 Correct 69 ms 2396 KB Correct answer: answer = 752723538884
127 Correct 14 ms 1668 KB Correct answer: answer = 1000000000000
128 Correct 19 ms 1600 KB Correct answer: answer = 999978000121
129 Correct 20 ms 1608 KB Correct answer: answer = 745986144735
130 Correct 12 ms 1484 KB Correct answer: answer = 2
131 Correct 64 ms 3328 KB Correct answer: answer = 277966670
132 Correct 64 ms 2988 KB Correct answer: answer = 2500900082
133 Correct 24 ms 1748 KB Correct answer: answer = 301248349636
134 Correct 37 ms 1612 KB Correct answer: answer = 14118891
135 Correct 19 ms 1660 KB Correct answer: answer = 14384977265
136 Correct 19 ms 1688 KB Correct answer: answer = 3681368330
137 Correct 19 ms 1688 KB Correct answer: answer = 2720316816
138 Correct 36 ms 2860 KB Correct answer: answer = 999976000144
139 Correct 37 ms 2756 KB Correct answer: answer = 999856102410
140 Correct 36 ms 2756 KB Correct answer: answer = 999958401531
141 Correct 38 ms 2760 KB Correct answer: answer = 999769649944
142 Correct 36 ms 2832 KB Correct answer: answer = 999874525918
143 Correct 128 ms 5444 KB Correct answer: answer = 6050000000
144 Correct 143 ms 6084 KB Correct answer: answer = 1112500000
145 Correct 78 ms 3940 KB Correct answer: answer = 4294967296
146 Correct 84 ms 4488 KB Correct answer: answer = 87652406
147 Correct 82 ms 4496 KB Correct answer: answer = 6297664
148 Correct 78 ms 4604 KB Correct answer: answer = 196612
149 Correct 123 ms 6724 KB Correct answer: answer = 15015100
150 Correct 123 ms 6764 KB Correct answer: answer = 25000000
151 Correct 138 ms 4228 KB Correct answer: answer = 333230209550
152 Correct 140 ms 4420 KB Correct answer: answer = 917123769
153 Correct 141 ms 6520 KB Correct answer: answer = 95162
154 Correct 123 ms 6720 KB Correct answer: answer = 382616191
155 Correct 124 ms 6800 KB Correct answer: answer = 990033333400
156 Correct 126 ms 6688 KB Correct answer: answer = 990000100000
157 Correct 133 ms 5548 KB Correct answer: answer = 749998188180
158 Correct 28 ms 2756 KB Correct answer: answer = 1000000000000
159 Correct 38 ms 2820 KB Correct answer: answer = 999988000036
160 Correct 36 ms 2848 KB Correct answer: answer = 744929274393
161 Correct 24 ms 2816 KB Correct answer: answer = 2
162 Correct 125 ms 6700 KB Correct answer: answer = 1300024
163 Correct 128 ms 5700 KB Correct answer: answer = 5000700010
164 Correct 48 ms 2984 KB Correct answer: answer = 354997100800
165 Correct 79 ms 3236 KB Correct answer: answer = 257000
166 Correct 71 ms 3524 KB Correct answer: answer = 3765323
167 Correct 72 ms 3524 KB Correct answer: answer = 1525903
168 Correct 37 ms 2756 KB Correct answer: answer = 67618137730
169 Correct 37 ms 2836 KB Correct answer: answer = 12656680171
170 Correct 40 ms 2848 KB Correct answer: answer = 579831736
171 Correct 69 ms 3612 KB Correct answer: answer = 23605611
172 Correct 40 ms 2948 KB Correct answer: answer = 7052481200
173 Correct 47 ms 3268 KB Correct answer: answer = 1314039500
174 Correct 55 ms 3560 KB Correct answer: answer = 302484000
175 Correct 93 ms 4252 KB Correct answer: answer = 52348480