Submission #44393

# Submission time Handle Problem Language Result Execution time Memory
44393 2018-04-01T15:35:56 Z szawinis Aliens (IOI16_aliens) C++17
100 / 100
234 ms 65364 KB
#include "aliens.h"
#include <bits/stdc++.h>
using ll = long long;
using namespace std;

inline ll square(ll x) { return x*x; }

int n, m, k;
vector<ll> l, r;

void tidy_up() {
	for(int i = 0; i < n; i++) if(l[i] > r[i]) swap(l[i], r[i]);
	vector<ll> id(n);
	iota(id.begin(), id.end(), 0);
	sort(id.begin(), id.end(), [] (int i, int j) {
		return make_pair(r[i], -l[i]) < make_pair(r[j], -l[j]);
	});
	vector<ll> tmp;
	tmp.push_back(-1);
	tmp.push_back(id[0]);
	for(int i = 1; i < n; i++) {
		while(tmp.size() > 1 && l[tmp.back()] >= l[id[i]]) tmp.pop_back();
		tmp.push_back(id[i]);
	}
	n = tmp.size() - 1;
	id = tmp;
	for(int i = 1; i <= n; i++) tmp[i] = r[id[i]];
	r = tmp;
	for(int i = 1; i <= n; i++) tmp[i] = l[id[i]];
	l = tmp;
}
struct cht {
	struct line {
		ll m, c;
		int cnt;
		line(ll m, ll c, int cnt): m(m), c(c), cnt(cnt) {};
		ll getVal(ll x) { return m*x + c; }
	};
	vector<line> f;
	int idx;
	bool bad(line l1, line l2, line l3) { // m1 >= m2 >= m3
		assert(l1.m >= l2.m && l2.m >= l3.m);
		return (double) (l1.c-l3.c)*(l2.m-l1.m) <= (double) (l1.c-l2.c)*(l3.m-l1.m);
	}
	void update(ll m, ll c, int cnt) {
		line l = line(m, c, cnt);
		while(f.size() >= 2 && bad(f[f.size()-2], f[f.size()-1], l)) f.pop_back();
		f.push_back(l);
	}
	pair<ll, int> query(ll x) {
		while(idx+1 < f.size() && f[idx+1].getVal(x) < f[idx].getVal(x)) ++idx;
		return make_pair(f[idx].getVal(x), f[idx].cnt);
	}
	void clear() { f.clear(); idx = 0; }
} hull;

pair<ll, int> calc(ll C) {
	vector<pair<ll, int> > dp = vector<pair<ll, int> >(n+1);
	hull.clear();
	dp[0] = {0, 0};
	hull.update(-2*(l[1]-1), square(l[1]-1), 0);
	for(int i = 1; i <= n; i++) {
		auto tmp = hull.query(r[i]);
		dp[i].first = tmp.first + square(r[i]) + C;
		dp[i].second = tmp.second + 1;
		if(i == n) break;
		hull.update(-2*(l[i+1]-1), square(l[i+1]-1) + dp[i].first - square(max(0ll, r[i] - l[i+1] + 1)), dp[i].second);
	}
	return dp[n];
}

ll take_photos(int _n, int _m, int _k, vector<int> _l, vector<int> _r) {
	n = _n, m = _m, k = _k;
	l.resize(n), r.resize(n);
	for(int i = 0; i < n; i++) l[i] = _l[i], r[i] = _r[i];
	tidy_up();
	ll s = 0, e = 1e17;
	while(s < e) {
		ll mid = s+e >> 1;
		if(calc(mid).second <= k) e = mid;
		else s = mid+1;
	}
	return calc(s).first - s * k;
}

Compilation message

aliens.cpp: In member function 'std::pair<long long int, int> cht::query(ll)':
aliens.cpp:51:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(idx+1 < f.size() && f[idx+1].getVal(x) < f[idx].getVal(x)) ++idx;
         ~~~~~~^~~~~~~~~~
aliens.cpp: In function 'll take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:79:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   ll mid = s+e >> 1;
            ~^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 356 KB Correct answer: answer = 4
3 Correct 2 ms 536 KB Correct answer: answer = 4
4 Correct 2 ms 536 KB Correct answer: answer = 12
5 Correct 2 ms 536 KB Correct answer: answer = 52
6 Correct 2 ms 544 KB Correct answer: answer = 210
7 Correct 2 ms 544 KB Correct answer: answer = 88
8 Correct 2 ms 544 KB Correct answer: answer = 7696
9 Correct 2 ms 628 KB Correct answer: answer = 1
10 Correct 2 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 628 KB Correct answer: answer = 151
14 Correct 2 ms 628 KB Correct answer: answer = 7550
15 Correct 2 ms 628 KB Correct answer: answer = 7220
16 Correct 2 ms 628 KB Correct answer: answer = 7550
17 Correct 2 ms 628 KB Correct answer: answer = 10000
18 Correct 2 ms 628 KB Correct answer: answer = 10000
19 Correct 2 ms 628 KB Correct answer: answer = 624
20 Correct 2 ms 628 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 2 ms 628 KB Correct answer: answer = 1
2 Correct 2 ms 628 KB Correct answer: answer = 4
3 Correct 2 ms 628 KB Correct answer: answer = 1
4 Correct 2 ms 628 KB Correct answer: answer = 5
5 Correct 2 ms 628 KB Correct answer: answer = 41
6 Correct 2 ms 628 KB Correct answer: answer = 71923
7 Correct 2 ms 636 KB Correct answer: answer = 77137
8 Correct 3 ms 636 KB Correct answer: answer = 764
9 Correct 2 ms 636 KB Correct answer: answer = 250000
10 Correct 3 ms 636 KB Correct answer: answer = 500
11 Correct 2 ms 636 KB Correct answer: answer = 32
12 Correct 3 ms 636 KB Correct answer: answer = 130050
13 Correct 3 ms 636 KB Correct answer: answer = 5110
14 Correct 2 ms 636 KB Correct answer: answer = 2626
15 Correct 2 ms 636 KB Correct answer: answer = 796
16 Correct 4 ms 636 KB Correct answer: answer = 7580
17 Correct 3 ms 636 KB Correct answer: answer = 1904
18 Correct 3 ms 692 KB Correct answer: answer = 996004
19 Correct 3 ms 692 KB Correct answer: answer = 38817
20 Correct 3 ms 692 KB Correct answer: answer = 4096
21 Correct 2 ms 692 KB Correct answer: answer = 1
22 Correct 2 ms 692 KB Correct answer: answer = 1
23 Correct 3 ms 748 KB Correct answer: answer = 2040
24 Correct 2 ms 748 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 356 KB Correct answer: answer = 4
3 Correct 2 ms 536 KB Correct answer: answer = 4
4 Correct 2 ms 536 KB Correct answer: answer = 12
5 Correct 2 ms 536 KB Correct answer: answer = 52
6 Correct 2 ms 544 KB Correct answer: answer = 210
7 Correct 2 ms 544 KB Correct answer: answer = 88
8 Correct 2 ms 544 KB Correct answer: answer = 7696
9 Correct 2 ms 628 KB Correct answer: answer = 1
10 Correct 2 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 628 KB Correct answer: answer = 151
14 Correct 2 ms 628 KB Correct answer: answer = 7550
15 Correct 2 ms 628 KB Correct answer: answer = 7220
16 Correct 2 ms 628 KB Correct answer: answer = 7550
17 Correct 2 ms 628 KB Correct answer: answer = 10000
18 Correct 2 ms 628 KB Correct answer: answer = 10000
19 Correct 2 ms 628 KB Correct answer: answer = 624
20 Correct 2 ms 628 KB Correct answer: answer = 10000
21 Correct 2 ms 628 KB Correct answer: answer = 1
22 Correct 2 ms 628 KB Correct answer: answer = 4
23 Correct 2 ms 628 KB Correct answer: answer = 1
24 Correct 2 ms 628 KB Correct answer: answer = 5
25 Correct 2 ms 628 KB Correct answer: answer = 41
26 Correct 2 ms 628 KB Correct answer: answer = 71923
27 Correct 2 ms 636 KB Correct answer: answer = 77137
28 Correct 3 ms 636 KB Correct answer: answer = 764
29 Correct 2 ms 636 KB Correct answer: answer = 250000
30 Correct 3 ms 636 KB Correct answer: answer = 500
31 Correct 2 ms 636 KB Correct answer: answer = 32
32 Correct 3 ms 636 KB Correct answer: answer = 130050
33 Correct 3 ms 636 KB Correct answer: answer = 5110
34 Correct 2 ms 636 KB Correct answer: answer = 2626
35 Correct 2 ms 636 KB Correct answer: answer = 796
36 Correct 4 ms 636 KB Correct answer: answer = 7580
37 Correct 3 ms 636 KB Correct answer: answer = 1904
38 Correct 3 ms 692 KB Correct answer: answer = 996004
39 Correct 3 ms 692 KB Correct answer: answer = 38817
40 Correct 3 ms 692 KB Correct answer: answer = 4096
41 Correct 2 ms 692 KB Correct answer: answer = 1
42 Correct 2 ms 692 KB Correct answer: answer = 1
43 Correct 3 ms 748 KB Correct answer: answer = 2040
44 Correct 2 ms 748 KB Correct answer: answer = 2
45 Correct 2 ms 748 KB Correct answer: answer = 4
46 Correct 2 ms 748 KB Correct answer: answer = 9
47 Correct 2 ms 748 KB Correct answer: answer = 9
48 Correct 2 ms 748 KB Correct answer: answer = 21
49 Correct 2 ms 748 KB Correct answer: answer = 71
50 Correct 2 ms 748 KB Correct answer: answer = 77
51 Correct 2 ms 748 KB Correct answer: answer = 400
52 Correct 3 ms 748 KB Correct answer: answer = 996004
53 Correct 2 ms 748 KB Correct answer: answer = 997310
54 Correct 3 ms 748 KB Correct answer: answer = 990781
55 Correct 2 ms 748 KB Correct answer: answer = 996545
56 Correct 2 ms 748 KB Correct answer: answer = 484
57 Correct 2 ms 748 KB Correct answer: answer = 484
58 Correct 4 ms 748 KB Correct answer: answer = 63501
59 Correct 2 ms 748 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 748 KB Correct answer: answer = 761480
62 Correct 3 ms 756 KB Correct answer: answer = 758932
63 Correct 2 ms 756 KB Correct answer: answer = 1000000
64 Correct 3 ms 756 KB Correct answer: answer = 750500
65 Correct 2 ms 756 KB Correct answer: answer = 1000000
66 Correct 2 ms 756 KB Correct answer: answer = 250000
67 Correct 2 ms 756 KB Correct answer: answer = 250000
68 Correct 2 ms 756 KB Correct answer: answer = 1000000
69 Correct 3 ms 756 KB Correct answer: answer = 994009
70 Correct 3 ms 756 KB Correct answer: answer = 59315
71 Correct 2 ms 756 KB Correct answer: answer = 25454
72 Correct 2 ms 756 KB Correct answer: answer = 1504
73 Correct 2 ms 756 KB Correct answer: answer = 37486
74 Correct 2 ms 756 KB Correct answer: answer = 4284
75 Correct 2 ms 756 KB Correct answer: answer = 158008
76 Correct 2 ms 756 KB Correct answer: answer = 51860
77 Correct 2 ms 756 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 356 KB Correct answer: answer = 4
3 Correct 2 ms 536 KB Correct answer: answer = 4
4 Correct 2 ms 536 KB Correct answer: answer = 12
5 Correct 2 ms 536 KB Correct answer: answer = 52
6 Correct 2 ms 544 KB Correct answer: answer = 210
7 Correct 2 ms 544 KB Correct answer: answer = 88
8 Correct 2 ms 544 KB Correct answer: answer = 7696
9 Correct 2 ms 628 KB Correct answer: answer = 1
10 Correct 2 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 628 KB Correct answer: answer = 151
14 Correct 2 ms 628 KB Correct answer: answer = 7550
15 Correct 2 ms 628 KB Correct answer: answer = 7220
16 Correct 2 ms 628 KB Correct answer: answer = 7550
17 Correct 2 ms 628 KB Correct answer: answer = 10000
18 Correct 2 ms 628 KB Correct answer: answer = 10000
19 Correct 2 ms 628 KB Correct answer: answer = 624
20 Correct 2 ms 628 KB Correct answer: answer = 10000
21 Correct 2 ms 628 KB Correct answer: answer = 1
22 Correct 2 ms 628 KB Correct answer: answer = 4
23 Correct 2 ms 628 KB Correct answer: answer = 1
24 Correct 2 ms 628 KB Correct answer: answer = 5
25 Correct 2 ms 628 KB Correct answer: answer = 41
26 Correct 2 ms 628 KB Correct answer: answer = 71923
27 Correct 2 ms 636 KB Correct answer: answer = 77137
28 Correct 3 ms 636 KB Correct answer: answer = 764
29 Correct 2 ms 636 KB Correct answer: answer = 250000
30 Correct 3 ms 636 KB Correct answer: answer = 500
31 Correct 2 ms 636 KB Correct answer: answer = 32
32 Correct 3 ms 636 KB Correct answer: answer = 130050
33 Correct 3 ms 636 KB Correct answer: answer = 5110
34 Correct 2 ms 636 KB Correct answer: answer = 2626
35 Correct 2 ms 636 KB Correct answer: answer = 796
36 Correct 4 ms 636 KB Correct answer: answer = 7580
37 Correct 3 ms 636 KB Correct answer: answer = 1904
38 Correct 3 ms 692 KB Correct answer: answer = 996004
39 Correct 3 ms 692 KB Correct answer: answer = 38817
40 Correct 3 ms 692 KB Correct answer: answer = 4096
41 Correct 2 ms 692 KB Correct answer: answer = 1
42 Correct 2 ms 692 KB Correct answer: answer = 1
43 Correct 3 ms 748 KB Correct answer: answer = 2040
44 Correct 2 ms 748 KB Correct answer: answer = 2
45 Correct 2 ms 748 KB Correct answer: answer = 4
46 Correct 2 ms 748 KB Correct answer: answer = 9
47 Correct 2 ms 748 KB Correct answer: answer = 9
48 Correct 2 ms 748 KB Correct answer: answer = 21
49 Correct 2 ms 748 KB Correct answer: answer = 71
50 Correct 2 ms 748 KB Correct answer: answer = 77
51 Correct 2 ms 748 KB Correct answer: answer = 400
52 Correct 3 ms 748 KB Correct answer: answer = 996004
53 Correct 2 ms 748 KB Correct answer: answer = 997310
54 Correct 3 ms 748 KB Correct answer: answer = 990781
55 Correct 2 ms 748 KB Correct answer: answer = 996545
56 Correct 2 ms 748 KB Correct answer: answer = 484
57 Correct 2 ms 748 KB Correct answer: answer = 484
58 Correct 4 ms 748 KB Correct answer: answer = 63501
59 Correct 2 ms 748 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 748 KB Correct answer: answer = 761480
62 Correct 3 ms 756 KB Correct answer: answer = 758932
63 Correct 2 ms 756 KB Correct answer: answer = 1000000
64 Correct 3 ms 756 KB Correct answer: answer = 750500
65 Correct 2 ms 756 KB Correct answer: answer = 1000000
66 Correct 2 ms 756 KB Correct answer: answer = 250000
67 Correct 2 ms 756 KB Correct answer: answer = 250000
68 Correct 2 ms 756 KB Correct answer: answer = 1000000
69 Correct 3 ms 756 KB Correct answer: answer = 994009
70 Correct 3 ms 756 KB Correct answer: answer = 59315
71 Correct 2 ms 756 KB Correct answer: answer = 25454
72 Correct 2 ms 756 KB Correct answer: answer = 1504
73 Correct 2 ms 756 KB Correct answer: answer = 37486
74 Correct 2 ms 756 KB Correct answer: answer = 4284
75 Correct 2 ms 756 KB Correct answer: answer = 158008
76 Correct 2 ms 756 KB Correct answer: answer = 51860
77 Correct 2 ms 756 KB Correct answer: answer = 12985
78 Correct 5 ms 764 KB Correct answer: answer = 997864126212
79 Correct 5 ms 764 KB Correct answer: answer = 998608411647
80 Correct 4 ms 764 KB Correct answer: answer = 995265560477
81 Correct 8 ms 892 KB Correct answer: answer = 10125000
82 Correct 9 ms 892 KB Correct answer: answer = 2291668
83 Correct 5 ms 892 KB Correct answer: answer = 42388
84 Correct 5 ms 892 KB Correct answer: answer = 10318
85 Correct 6 ms 892 KB Correct answer: answer = 3416
86 Correct 10 ms 892 KB Correct answer: answer = 331708193881
87 Correct 11 ms 892 KB Correct answer: answer = 2861193756
88 Correct 13 ms 892 KB Correct answer: answer = 114646930
89 Correct 10 ms 892 KB Correct answer: answer = 9280921
90 Correct 8 ms 892 KB Correct answer: answer = 999984053400
91 Correct 10 ms 892 KB Correct answer: answer = 750935949134
92 Correct 3 ms 892 KB Correct answer: answer = 1000000000000
93 Correct 4 ms 892 KB Correct answer: answer = 998762383161
94 Correct 10 ms 892 KB Correct answer: answer = 23017412908
95 Correct 4 ms 892 KB Correct answer: answer = 728143410622
96 Correct 3 ms 892 KB Correct answer: answer = 2
97 Correct 8 ms 892 KB Correct answer: answer = 1824916
98 Correct 8 ms 892 KB Correct answer: answer = 10680029
99 Correct 9 ms 896 KB Correct answer: answer = 18351700
100 Correct 8 ms 896 KB Correct answer: answer = 16040026
101 Correct 4 ms 896 KB Correct answer: answer = 253968628325
102 Correct 5 ms 896 KB Correct answer: answer = 10267
103 Correct 9 ms 980 KB Correct answer: answer = 2582408
104 Correct 3 ms 980 KB Correct answer: answer = 78024964781
105 Correct 4 ms 980 KB Correct answer: answer = 9866346457
106 Correct 5 ms 980 KB Correct answer: answer = 3327720949
107 Correct 4 ms 980 KB Correct answer: answer = 86064128360
108 Correct 6 ms 980 KB Correct answer: answer = 12698259150
109 Correct 8 ms 980 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 356 KB Correct answer: answer = 4
3 Correct 2 ms 536 KB Correct answer: answer = 4
4 Correct 2 ms 536 KB Correct answer: answer = 12
5 Correct 2 ms 536 KB Correct answer: answer = 52
6 Correct 2 ms 544 KB Correct answer: answer = 210
7 Correct 2 ms 544 KB Correct answer: answer = 88
8 Correct 2 ms 544 KB Correct answer: answer = 7696
9 Correct 2 ms 628 KB Correct answer: answer = 1
10 Correct 2 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 628 KB Correct answer: answer = 151
14 Correct 2 ms 628 KB Correct answer: answer = 7550
15 Correct 2 ms 628 KB Correct answer: answer = 7220
16 Correct 2 ms 628 KB Correct answer: answer = 7550
17 Correct 2 ms 628 KB Correct answer: answer = 10000
18 Correct 2 ms 628 KB Correct answer: answer = 10000
19 Correct 2 ms 628 KB Correct answer: answer = 624
20 Correct 2 ms 628 KB Correct answer: answer = 10000
21 Correct 2 ms 628 KB Correct answer: answer = 1
22 Correct 2 ms 628 KB Correct answer: answer = 4
23 Correct 2 ms 628 KB Correct answer: answer = 1
24 Correct 2 ms 628 KB Correct answer: answer = 5
25 Correct 2 ms 628 KB Correct answer: answer = 41
26 Correct 2 ms 628 KB Correct answer: answer = 71923
27 Correct 2 ms 636 KB Correct answer: answer = 77137
28 Correct 3 ms 636 KB Correct answer: answer = 764
29 Correct 2 ms 636 KB Correct answer: answer = 250000
30 Correct 3 ms 636 KB Correct answer: answer = 500
31 Correct 2 ms 636 KB Correct answer: answer = 32
32 Correct 3 ms 636 KB Correct answer: answer = 130050
33 Correct 3 ms 636 KB Correct answer: answer = 5110
34 Correct 2 ms 636 KB Correct answer: answer = 2626
35 Correct 2 ms 636 KB Correct answer: answer = 796
36 Correct 4 ms 636 KB Correct answer: answer = 7580
37 Correct 3 ms 636 KB Correct answer: answer = 1904
38 Correct 3 ms 692 KB Correct answer: answer = 996004
39 Correct 3 ms 692 KB Correct answer: answer = 38817
40 Correct 3 ms 692 KB Correct answer: answer = 4096
41 Correct 2 ms 692 KB Correct answer: answer = 1
42 Correct 2 ms 692 KB Correct answer: answer = 1
43 Correct 3 ms 748 KB Correct answer: answer = 2040
44 Correct 2 ms 748 KB Correct answer: answer = 2
45 Correct 2 ms 748 KB Correct answer: answer = 4
46 Correct 2 ms 748 KB Correct answer: answer = 9
47 Correct 2 ms 748 KB Correct answer: answer = 9
48 Correct 2 ms 748 KB Correct answer: answer = 21
49 Correct 2 ms 748 KB Correct answer: answer = 71
50 Correct 2 ms 748 KB Correct answer: answer = 77
51 Correct 2 ms 748 KB Correct answer: answer = 400
52 Correct 3 ms 748 KB Correct answer: answer = 996004
53 Correct 2 ms 748 KB Correct answer: answer = 997310
54 Correct 3 ms 748 KB Correct answer: answer = 990781
55 Correct 2 ms 748 KB Correct answer: answer = 996545
56 Correct 2 ms 748 KB Correct answer: answer = 484
57 Correct 2 ms 748 KB Correct answer: answer = 484
58 Correct 4 ms 748 KB Correct answer: answer = 63501
59 Correct 2 ms 748 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 748 KB Correct answer: answer = 761480
62 Correct 3 ms 756 KB Correct answer: answer = 758932
63 Correct 2 ms 756 KB Correct answer: answer = 1000000
64 Correct 3 ms 756 KB Correct answer: answer = 750500
65 Correct 2 ms 756 KB Correct answer: answer = 1000000
66 Correct 2 ms 756 KB Correct answer: answer = 250000
67 Correct 2 ms 756 KB Correct answer: answer = 250000
68 Correct 2 ms 756 KB Correct answer: answer = 1000000
69 Correct 3 ms 756 KB Correct answer: answer = 994009
70 Correct 3 ms 756 KB Correct answer: answer = 59315
71 Correct 2 ms 756 KB Correct answer: answer = 25454
72 Correct 2 ms 756 KB Correct answer: answer = 1504
73 Correct 2 ms 756 KB Correct answer: answer = 37486
74 Correct 2 ms 756 KB Correct answer: answer = 4284
75 Correct 2 ms 756 KB Correct answer: answer = 158008
76 Correct 2 ms 756 KB Correct answer: answer = 51860
77 Correct 2 ms 756 KB Correct answer: answer = 12985
78 Correct 5 ms 764 KB Correct answer: answer = 997864126212
79 Correct 5 ms 764 KB Correct answer: answer = 998608411647
80 Correct 4 ms 764 KB Correct answer: answer = 995265560477
81 Correct 8 ms 892 KB Correct answer: answer = 10125000
82 Correct 9 ms 892 KB Correct answer: answer = 2291668
83 Correct 5 ms 892 KB Correct answer: answer = 42388
84 Correct 5 ms 892 KB Correct answer: answer = 10318
85 Correct 6 ms 892 KB Correct answer: answer = 3416
86 Correct 10 ms 892 KB Correct answer: answer = 331708193881
87 Correct 11 ms 892 KB Correct answer: answer = 2861193756
88 Correct 13 ms 892 KB Correct answer: answer = 114646930
89 Correct 10 ms 892 KB Correct answer: answer = 9280921
90 Correct 8 ms 892 KB Correct answer: answer = 999984053400
91 Correct 10 ms 892 KB Correct answer: answer = 750935949134
92 Correct 3 ms 892 KB Correct answer: answer = 1000000000000
93 Correct 4 ms 892 KB Correct answer: answer = 998762383161
94 Correct 10 ms 892 KB Correct answer: answer = 23017412908
95 Correct 4 ms 892 KB Correct answer: answer = 728143410622
96 Correct 3 ms 892 KB Correct answer: answer = 2
97 Correct 8 ms 892 KB Correct answer: answer = 1824916
98 Correct 8 ms 892 KB Correct answer: answer = 10680029
99 Correct 9 ms 896 KB Correct answer: answer = 18351700
100 Correct 8 ms 896 KB Correct answer: answer = 16040026
101 Correct 4 ms 896 KB Correct answer: answer = 253968628325
102 Correct 5 ms 896 KB Correct answer: answer = 10267
103 Correct 9 ms 980 KB Correct answer: answer = 2582408
104 Correct 3 ms 980 KB Correct answer: answer = 78024964781
105 Correct 4 ms 980 KB Correct answer: answer = 9866346457
106 Correct 5 ms 980 KB Correct answer: answer = 3327720949
107 Correct 4 ms 980 KB Correct answer: answer = 86064128360
108 Correct 6 ms 980 KB Correct answer: answer = 12698259150
109 Correct 8 ms 980 KB Correct answer: answer = 1185259288
110 Correct 26 ms 2556 KB Correct answer: answer = 999889968863
111 Correct 36 ms 3196 KB Correct answer: answer = 999861384931
112 Correct 26 ms 3920 KB Correct answer: answer = 999811809929
113 Correct 29 ms 4596 KB Correct answer: answer = 999869756441
114 Correct 90 ms 7028 KB Correct answer: answer = 1700000000
115 Correct 88 ms 8504 KB Correct answer: answer = 131666670
116 Correct 27 ms 8504 KB Correct answer: answer = 89478486
117 Correct 28 ms 8504 KB Correct answer: answer = 4971040
118 Correct 28 ms 8504 KB Correct answer: answer = 2711494
119 Correct 90 ms 9576 KB Correct answer: answer = 25252530
120 Correct 84 ms 10156 KB Correct answer: answer = 62500000
121 Correct 121 ms 10156 KB Correct answer: answer = 333175097780
122 Correct 111 ms 10156 KB Correct answer: answer = 33121180179
123 Correct 109 ms 10260 KB Correct answer: answer = 9802314015
124 Correct 88 ms 12788 KB Correct answer: answer = 32567551
125 Correct 91 ms 13360 KB Correct answer: answer = 997525000000
126 Correct 105 ms 13360 KB Correct answer: answer = 752723538884
127 Correct 16 ms 13360 KB Correct answer: answer = 1000000000000
128 Correct 24 ms 13360 KB Correct answer: answer = 999978000121
129 Correct 27 ms 13360 KB Correct answer: answer = 745986144735
130 Correct 13 ms 13524 KB Correct answer: answer = 2
131 Correct 88 ms 16824 KB Correct answer: answer = 277966670
132 Correct 85 ms 16824 KB Correct answer: answer = 2500900082
133 Correct 34 ms 16824 KB Correct answer: answer = 301248349636
134 Correct 52 ms 16824 KB Correct answer: answer = 14118891
135 Correct 26 ms 16824 KB Correct answer: answer = 14384977265
136 Correct 28 ms 17044 KB Correct answer: answer = 3681368330
137 Correct 27 ms 17636 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 356 KB Correct answer: answer = 4
3 Correct 2 ms 536 KB Correct answer: answer = 4
4 Correct 2 ms 536 KB Correct answer: answer = 12
5 Correct 2 ms 536 KB Correct answer: answer = 52
6 Correct 2 ms 544 KB Correct answer: answer = 210
7 Correct 2 ms 544 KB Correct answer: answer = 88
8 Correct 2 ms 544 KB Correct answer: answer = 7696
9 Correct 2 ms 628 KB Correct answer: answer = 1
10 Correct 2 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 628 KB Correct answer: answer = 151
14 Correct 2 ms 628 KB Correct answer: answer = 7550
15 Correct 2 ms 628 KB Correct answer: answer = 7220
16 Correct 2 ms 628 KB Correct answer: answer = 7550
17 Correct 2 ms 628 KB Correct answer: answer = 10000
18 Correct 2 ms 628 KB Correct answer: answer = 10000
19 Correct 2 ms 628 KB Correct answer: answer = 624
20 Correct 2 ms 628 KB Correct answer: answer = 10000
21 Correct 2 ms 628 KB Correct answer: answer = 1
22 Correct 2 ms 628 KB Correct answer: answer = 4
23 Correct 2 ms 628 KB Correct answer: answer = 1
24 Correct 2 ms 628 KB Correct answer: answer = 5
25 Correct 2 ms 628 KB Correct answer: answer = 41
26 Correct 2 ms 628 KB Correct answer: answer = 71923
27 Correct 2 ms 636 KB Correct answer: answer = 77137
28 Correct 3 ms 636 KB Correct answer: answer = 764
29 Correct 2 ms 636 KB Correct answer: answer = 250000
30 Correct 3 ms 636 KB Correct answer: answer = 500
31 Correct 2 ms 636 KB Correct answer: answer = 32
32 Correct 3 ms 636 KB Correct answer: answer = 130050
33 Correct 3 ms 636 KB Correct answer: answer = 5110
34 Correct 2 ms 636 KB Correct answer: answer = 2626
35 Correct 2 ms 636 KB Correct answer: answer = 796
36 Correct 4 ms 636 KB Correct answer: answer = 7580
37 Correct 3 ms 636 KB Correct answer: answer = 1904
38 Correct 3 ms 692 KB Correct answer: answer = 996004
39 Correct 3 ms 692 KB Correct answer: answer = 38817
40 Correct 3 ms 692 KB Correct answer: answer = 4096
41 Correct 2 ms 692 KB Correct answer: answer = 1
42 Correct 2 ms 692 KB Correct answer: answer = 1
43 Correct 3 ms 748 KB Correct answer: answer = 2040
44 Correct 2 ms 748 KB Correct answer: answer = 2
45 Correct 2 ms 748 KB Correct answer: answer = 4
46 Correct 2 ms 748 KB Correct answer: answer = 9
47 Correct 2 ms 748 KB Correct answer: answer = 9
48 Correct 2 ms 748 KB Correct answer: answer = 21
49 Correct 2 ms 748 KB Correct answer: answer = 71
50 Correct 2 ms 748 KB Correct answer: answer = 77
51 Correct 2 ms 748 KB Correct answer: answer = 400
52 Correct 3 ms 748 KB Correct answer: answer = 996004
53 Correct 2 ms 748 KB Correct answer: answer = 997310
54 Correct 3 ms 748 KB Correct answer: answer = 990781
55 Correct 2 ms 748 KB Correct answer: answer = 996545
56 Correct 2 ms 748 KB Correct answer: answer = 484
57 Correct 2 ms 748 KB Correct answer: answer = 484
58 Correct 4 ms 748 KB Correct answer: answer = 63501
59 Correct 2 ms 748 KB Correct answer: answer = 323501
60 Correct 3 ms 748 KB Correct answer: answer = 752500
61 Correct 2 ms 748 KB Correct answer: answer = 761480
62 Correct 3 ms 756 KB Correct answer: answer = 758932
63 Correct 2 ms 756 KB Correct answer: answer = 1000000
64 Correct 3 ms 756 KB Correct answer: answer = 750500
65 Correct 2 ms 756 KB Correct answer: answer = 1000000
66 Correct 2 ms 756 KB Correct answer: answer = 250000
67 Correct 2 ms 756 KB Correct answer: answer = 250000
68 Correct 2 ms 756 KB Correct answer: answer = 1000000
69 Correct 3 ms 756 KB Correct answer: answer = 994009
70 Correct 3 ms 756 KB Correct answer: answer = 59315
71 Correct 2 ms 756 KB Correct answer: answer = 25454
72 Correct 2 ms 756 KB Correct answer: answer = 1504
73 Correct 2 ms 756 KB Correct answer: answer = 37486
74 Correct 2 ms 756 KB Correct answer: answer = 4284
75 Correct 2 ms 756 KB Correct answer: answer = 158008
76 Correct 2 ms 756 KB Correct answer: answer = 51860
77 Correct 2 ms 756 KB Correct answer: answer = 12985
78 Correct 5 ms 764 KB Correct answer: answer = 997864126212
79 Correct 5 ms 764 KB Correct answer: answer = 998608411647
80 Correct 4 ms 764 KB Correct answer: answer = 995265560477
81 Correct 8 ms 892 KB Correct answer: answer = 10125000
82 Correct 9 ms 892 KB Correct answer: answer = 2291668
83 Correct 5 ms 892 KB Correct answer: answer = 42388
84 Correct 5 ms 892 KB Correct answer: answer = 10318
85 Correct 6 ms 892 KB Correct answer: answer = 3416
86 Correct 10 ms 892 KB Correct answer: answer = 331708193881
87 Correct 11 ms 892 KB Correct answer: answer = 2861193756
88 Correct 13 ms 892 KB Correct answer: answer = 114646930
89 Correct 10 ms 892 KB Correct answer: answer = 9280921
90 Correct 8 ms 892 KB Correct answer: answer = 999984053400
91 Correct 10 ms 892 KB Correct answer: answer = 750935949134
92 Correct 3 ms 892 KB Correct answer: answer = 1000000000000
93 Correct 4 ms 892 KB Correct answer: answer = 998762383161
94 Correct 10 ms 892 KB Correct answer: answer = 23017412908
95 Correct 4 ms 892 KB Correct answer: answer = 728143410622
96 Correct 3 ms 892 KB Correct answer: answer = 2
97 Correct 8 ms 892 KB Correct answer: answer = 1824916
98 Correct 8 ms 892 KB Correct answer: answer = 10680029
99 Correct 9 ms 896 KB Correct answer: answer = 18351700
100 Correct 8 ms 896 KB Correct answer: answer = 16040026
101 Correct 4 ms 896 KB Correct answer: answer = 253968628325
102 Correct 5 ms 896 KB Correct answer: answer = 10267
103 Correct 9 ms 980 KB Correct answer: answer = 2582408
104 Correct 3 ms 980 KB Correct answer: answer = 78024964781
105 Correct 4 ms 980 KB Correct answer: answer = 9866346457
106 Correct 5 ms 980 KB Correct answer: answer = 3327720949
107 Correct 4 ms 980 KB Correct answer: answer = 86064128360
108 Correct 6 ms 980 KB Correct answer: answer = 12698259150
109 Correct 8 ms 980 KB Correct answer: answer = 1185259288
110 Correct 26 ms 2556 KB Correct answer: answer = 999889968863
111 Correct 36 ms 3196 KB Correct answer: answer = 999861384931
112 Correct 26 ms 3920 KB Correct answer: answer = 999811809929
113 Correct 29 ms 4596 KB Correct answer: answer = 999869756441
114 Correct 90 ms 7028 KB Correct answer: answer = 1700000000
115 Correct 88 ms 8504 KB Correct answer: answer = 131666670
116 Correct 27 ms 8504 KB Correct answer: answer = 89478486
117 Correct 28 ms 8504 KB Correct answer: answer = 4971040
118 Correct 28 ms 8504 KB Correct answer: answer = 2711494
119 Correct 90 ms 9576 KB Correct answer: answer = 25252530
120 Correct 84 ms 10156 KB Correct answer: answer = 62500000
121 Correct 121 ms 10156 KB Correct answer: answer = 333175097780
122 Correct 111 ms 10156 KB Correct answer: answer = 33121180179
123 Correct 109 ms 10260 KB Correct answer: answer = 9802314015
124 Correct 88 ms 12788 KB Correct answer: answer = 32567551
125 Correct 91 ms 13360 KB Correct answer: answer = 997525000000
126 Correct 105 ms 13360 KB Correct answer: answer = 752723538884
127 Correct 16 ms 13360 KB Correct answer: answer = 1000000000000
128 Correct 24 ms 13360 KB Correct answer: answer = 999978000121
129 Correct 27 ms 13360 KB Correct answer: answer = 745986144735
130 Correct 13 ms 13524 KB Correct answer: answer = 2
131 Correct 88 ms 16824 KB Correct answer: answer = 277966670
132 Correct 85 ms 16824 KB Correct answer: answer = 2500900082
133 Correct 34 ms 16824 KB Correct answer: answer = 301248349636
134 Correct 52 ms 16824 KB Correct answer: answer = 14118891
135 Correct 26 ms 16824 KB Correct answer: answer = 14384977265
136 Correct 28 ms 17044 KB Correct answer: answer = 3681368330
137 Correct 27 ms 17636 KB Correct answer: answer = 2720316816
138 Correct 59 ms 20996 KB Correct answer: answer = 999976000144
139 Correct 55 ms 22336 KB Correct answer: answer = 999856102410
140 Correct 54 ms 23600 KB Correct answer: answer = 999958401531
141 Correct 52 ms 25040 KB Correct answer: answer = 999769649944
142 Correct 53 ms 26388 KB Correct answer: answer = 999874525918
143 Correct 180 ms 30936 KB Correct answer: answer = 6050000000
144 Correct 197 ms 34044 KB Correct answer: answer = 1112500000
145 Correct 115 ms 34044 KB Correct answer: answer = 4294967296
146 Correct 118 ms 34044 KB Correct answer: answer = 87652406
147 Correct 116 ms 34044 KB Correct answer: answer = 6297664
148 Correct 106 ms 34044 KB Correct answer: answer = 196612
149 Correct 185 ms 38316 KB Correct answer: answer = 15015100
150 Correct 166 ms 39468 KB Correct answer: answer = 25000000
151 Correct 234 ms 39468 KB Correct answer: answer = 333230209550
152 Correct 217 ms 39468 KB Correct answer: answer = 917123769
153 Correct 218 ms 41960 KB Correct answer: answer = 95162
154 Correct 216 ms 44664 KB Correct answer: answer = 382616191
155 Correct 178 ms 45856 KB Correct answer: answer = 990033333400
156 Correct 180 ms 47196 KB Correct answer: answer = 990000100000
157 Correct 198 ms 47196 KB Correct answer: answer = 749998188180
158 Correct 31 ms 47196 KB Correct answer: answer = 1000000000000
159 Correct 47 ms 47196 KB Correct answer: answer = 999988000036
160 Correct 57 ms 47248 KB Correct answer: answer = 744929274393
161 Correct 23 ms 47456 KB Correct answer: answer = 2
162 Correct 186 ms 53992 KB Correct answer: answer = 1300024
163 Correct 191 ms 53992 KB Correct answer: answer = 5000700010
164 Correct 71 ms 53992 KB Correct answer: answer = 354997100800
165 Correct 104 ms 53992 KB Correct answer: answer = 257000
166 Correct 98 ms 53992 KB Correct answer: answer = 3765323
167 Correct 97 ms 53992 KB Correct answer: answer = 1525903
168 Correct 79 ms 54320 KB Correct answer: answer = 67618137730
169 Correct 53 ms 55696 KB Correct answer: answer = 12656680171
170 Correct 56 ms 57044 KB Correct answer: answer = 579831736
171 Correct 98 ms 58804 KB Correct answer: answer = 23605611
172 Correct 55 ms 59768 KB Correct answer: answer = 7052481200
173 Correct 65 ms 61244 KB Correct answer: answer = 1314039500
174 Correct 85 ms 63176 KB Correct answer: answer = 302484000
175 Correct 165 ms 65364 KB Correct answer: answer = 52348480