Submission #49658

# Submission time Handle Problem Language Result Execution time Memory
49658 2018-06-01T17:23:57 Z khsoo01 Aliens (IOI16_aliens) C++11
100 / 100
238 ms 68740 KB
#include "aliens.h"
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll N = 100005, inf = 1e12;

ll n, m, k;
pll dt[N];

vector<pll> raw, a;

struct hull {
	deque<pair<pll, ll> > v;
	void clear () {v.clear();}
	bool well (pll &A, pll &B, pll &C) {
		return (B.Y - A.Y) * (A.X - C.X) < (C.Y - A.Y) * (A.X - B.X);
	}
	ll val (pll &T, ll P) {
		return T.X*P+T.Y;
	}
	void upd (pair<pll, ll> A) {
		for(ll i=v.size();i-->1;) {
			if(well(v[i-1].X, v[i].X, A.X)) break;
			else v.pop_back();
		}
		v.push_back(A);
	}
	pll get (ll P) {
		while(v.size() > 1) {
			if(val(v[0].X, P) <= val(v[1].X, P)) break;
			else v.pop_front();
		}
		return pll(val(v[0].X, P), v[0].Y+1);
	}
} h;

ll sq (ll X) {
	return X*X;
}

pll solve (ll L) {
	h.clear();
	h.upd({pll(-2*(a[0].X-1), sq(a[0].X-1) + L), 0});
	for(ll i=0;i<n;i++) {
		auto T = h.get(a[i].Y);
		dt[i] = {T.X + sq(a[i].Y), T.Y};
		if(i+1 == n) continue;
		h.upd({{-2*(a[i+1].X-1), sq(a[i+1].X-1) - sq(max(0ll, a[i].Y-a[i+1].X+1)) + dt[i].X + L}, T.Y});
	}
	return dt[n-1];
}

ll take_photos(int _n, int _m, int _k, vector<int> r, vector<int> c) {
	m = _m; k = _k;
	for(ll i=0;i<_n;i++) {
		if(r[i] < c[i]) raw.push_back({r[i], c[i]});
		else raw.push_back({c[i], r[i]});
	}
	sort(raw.begin(), raw.end());
	for(auto &T : raw) {
		if(a.empty() || a.back().Y < T.Y) a.push_back(T);
	}
	n = a.size();
	ll S = 0, E = inf;
	while(S<E) {
		ll M = (S+E)/2;
		solve(M).Y <= k ? E = M : S = M+1;
	}
	return solve(S).X - k * S;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct answer: answer = 4
2 Correct 2 ms 508 KB Correct answer: answer = 4
3 Correct 2 ms 508 KB Correct answer: answer = 4
4 Correct 2 ms 508 KB Correct answer: answer = 12
5 Correct 2 ms 508 KB Correct answer: answer = 52
6 Correct 2 ms 560 KB Correct answer: answer = 210
7 Correct 2 ms 576 KB Correct answer: answer = 88
8 Correct 2 ms 608 KB Correct answer: answer = 7696
9 Correct 2 ms 656 KB Correct answer: answer = 1
10 Correct 2 ms 660 KB Correct answer: answer = 2374
11 Correct 2 ms 668 KB Correct answer: answer = 9502
12 Correct 3 ms 792 KB Correct answer: answer = 49
13 Correct 3 ms 792 KB Correct answer: answer = 151
14 Correct 3 ms 792 KB Correct answer: answer = 7550
15 Correct 4 ms 792 KB Correct answer: answer = 7220
16 Correct 3 ms 792 KB Correct answer: answer = 7550
17 Correct 2 ms 792 KB Correct answer: answer = 10000
18 Correct 3 ms 792 KB Correct answer: answer = 10000
19 Correct 2 ms 792 KB Correct answer: answer = 624
20 Correct 2 ms 792 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 2 ms 792 KB Correct answer: answer = 1
2 Correct 2 ms 792 KB Correct answer: answer = 4
3 Correct 2 ms 792 KB Correct answer: answer = 1
4 Correct 2 ms 792 KB Correct answer: answer = 5
5 Correct 2 ms 792 KB Correct answer: answer = 41
6 Correct 3 ms 792 KB Correct answer: answer = 71923
7 Correct 2 ms 796 KB Correct answer: answer = 77137
8 Correct 3 ms 844 KB Correct answer: answer = 764
9 Correct 3 ms 848 KB Correct answer: answer = 250000
10 Correct 3 ms 852 KB Correct answer: answer = 500
11 Correct 3 ms 852 KB Correct answer: answer = 32
12 Correct 3 ms 860 KB Correct answer: answer = 130050
13 Correct 4 ms 864 KB Correct answer: answer = 5110
14 Correct 3 ms 868 KB Correct answer: answer = 2626
15 Correct 3 ms 872 KB Correct answer: answer = 796
16 Correct 3 ms 876 KB Correct answer: answer = 7580
17 Correct 3 ms 880 KB Correct answer: answer = 1904
18 Correct 3 ms 884 KB Correct answer: answer = 996004
19 Correct 4 ms 888 KB Correct answer: answer = 38817
20 Correct 3 ms 892 KB Correct answer: answer = 4096
21 Correct 3 ms 896 KB Correct answer: answer = 1
22 Correct 3 ms 900 KB Correct answer: answer = 1
23 Correct 3 ms 908 KB Correct answer: answer = 2040
24 Correct 2 ms 908 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 508 KB Correct answer: answer = 4
3 Correct 2 ms 508 KB Correct answer: answer = 4
4 Correct 2 ms 508 KB Correct answer: answer = 12
5 Correct 2 ms 508 KB Correct answer: answer = 52
6 Correct 2 ms 560 KB Correct answer: answer = 210
7 Correct 2 ms 576 KB Correct answer: answer = 88
8 Correct 2 ms 608 KB Correct answer: answer = 7696
9 Correct 2 ms 656 KB Correct answer: answer = 1
10 Correct 2 ms 660 KB Correct answer: answer = 2374
11 Correct 2 ms 668 KB Correct answer: answer = 9502
12 Correct 3 ms 792 KB Correct answer: answer = 49
13 Correct 3 ms 792 KB Correct answer: answer = 151
14 Correct 3 ms 792 KB Correct answer: answer = 7550
15 Correct 4 ms 792 KB Correct answer: answer = 7220
16 Correct 3 ms 792 KB Correct answer: answer = 7550
17 Correct 2 ms 792 KB Correct answer: answer = 10000
18 Correct 3 ms 792 KB Correct answer: answer = 10000
19 Correct 2 ms 792 KB Correct answer: answer = 624
20 Correct 2 ms 792 KB Correct answer: answer = 10000
21 Correct 2 ms 792 KB Correct answer: answer = 1
22 Correct 2 ms 792 KB Correct answer: answer = 4
23 Correct 2 ms 792 KB Correct answer: answer = 1
24 Correct 2 ms 792 KB Correct answer: answer = 5
25 Correct 2 ms 792 KB Correct answer: answer = 41
26 Correct 3 ms 792 KB Correct answer: answer = 71923
27 Correct 2 ms 796 KB Correct answer: answer = 77137
28 Correct 3 ms 844 KB Correct answer: answer = 764
29 Correct 3 ms 848 KB Correct answer: answer = 250000
30 Correct 3 ms 852 KB Correct answer: answer = 500
31 Correct 3 ms 852 KB Correct answer: answer = 32
32 Correct 3 ms 860 KB Correct answer: answer = 130050
33 Correct 4 ms 864 KB Correct answer: answer = 5110
34 Correct 3 ms 868 KB Correct answer: answer = 2626
35 Correct 3 ms 872 KB Correct answer: answer = 796
36 Correct 3 ms 876 KB Correct answer: answer = 7580
37 Correct 3 ms 880 KB Correct answer: answer = 1904
38 Correct 3 ms 884 KB Correct answer: answer = 996004
39 Correct 4 ms 888 KB Correct answer: answer = 38817
40 Correct 3 ms 892 KB Correct answer: answer = 4096
41 Correct 3 ms 896 KB Correct answer: answer = 1
42 Correct 3 ms 900 KB Correct answer: answer = 1
43 Correct 3 ms 908 KB Correct answer: answer = 2040
44 Correct 2 ms 908 KB Correct answer: answer = 2
45 Correct 3 ms 908 KB Correct answer: answer = 4
46 Correct 2 ms 916 KB Correct answer: answer = 9
47 Correct 2 ms 916 KB Correct answer: answer = 9
48 Correct 2 ms 916 KB Correct answer: answer = 21
49 Correct 2 ms 928 KB Correct answer: answer = 71
50 Correct 2 ms 928 KB Correct answer: answer = 77
51 Correct 2 ms 936 KB Correct answer: answer = 400
52 Correct 2 ms 940 KB Correct answer: answer = 996004
53 Correct 2 ms 1052 KB Correct answer: answer = 997310
54 Correct 2 ms 1052 KB Correct answer: answer = 990781
55 Correct 2 ms 1052 KB Correct answer: answer = 996545
56 Correct 2 ms 1052 KB Correct answer: answer = 484
57 Correct 3 ms 1052 KB Correct answer: answer = 484
58 Correct 4 ms 1052 KB Correct answer: answer = 63501
59 Correct 4 ms 1052 KB Correct answer: answer = 323501
60 Correct 3 ms 1052 KB Correct answer: answer = 752500
61 Correct 3 ms 1052 KB Correct answer: answer = 761480
62 Correct 3 ms 1052 KB Correct answer: answer = 758932
63 Correct 2 ms 1052 KB Correct answer: answer = 1000000
64 Correct 3 ms 1052 KB Correct answer: answer = 750500
65 Correct 2 ms 1052 KB Correct answer: answer = 1000000
66 Correct 3 ms 1052 KB Correct answer: answer = 250000
67 Correct 3 ms 1052 KB Correct answer: answer = 250000
68 Correct 2 ms 1052 KB Correct answer: answer = 1000000
69 Correct 3 ms 1052 KB Correct answer: answer = 994009
70 Correct 3 ms 1052 KB Correct answer: answer = 59315
71 Correct 3 ms 1052 KB Correct answer: answer = 25454
72 Correct 4 ms 1052 KB Correct answer: answer = 1504
73 Correct 3 ms 1052 KB Correct answer: answer = 37486
74 Correct 3 ms 1156 KB Correct answer: answer = 4284
75 Correct 3 ms 1156 KB Correct answer: answer = 158008
76 Correct 2 ms 1156 KB Correct answer: answer = 51860
77 Correct 3 ms 1156 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 508 KB Correct answer: answer = 4
3 Correct 2 ms 508 KB Correct answer: answer = 4
4 Correct 2 ms 508 KB Correct answer: answer = 12
5 Correct 2 ms 508 KB Correct answer: answer = 52
6 Correct 2 ms 560 KB Correct answer: answer = 210
7 Correct 2 ms 576 KB Correct answer: answer = 88
8 Correct 2 ms 608 KB Correct answer: answer = 7696
9 Correct 2 ms 656 KB Correct answer: answer = 1
10 Correct 2 ms 660 KB Correct answer: answer = 2374
11 Correct 2 ms 668 KB Correct answer: answer = 9502
12 Correct 3 ms 792 KB Correct answer: answer = 49
13 Correct 3 ms 792 KB Correct answer: answer = 151
14 Correct 3 ms 792 KB Correct answer: answer = 7550
15 Correct 4 ms 792 KB Correct answer: answer = 7220
16 Correct 3 ms 792 KB Correct answer: answer = 7550
17 Correct 2 ms 792 KB Correct answer: answer = 10000
18 Correct 3 ms 792 KB Correct answer: answer = 10000
19 Correct 2 ms 792 KB Correct answer: answer = 624
20 Correct 2 ms 792 KB Correct answer: answer = 10000
21 Correct 2 ms 792 KB Correct answer: answer = 1
22 Correct 2 ms 792 KB Correct answer: answer = 4
23 Correct 2 ms 792 KB Correct answer: answer = 1
24 Correct 2 ms 792 KB Correct answer: answer = 5
25 Correct 2 ms 792 KB Correct answer: answer = 41
26 Correct 3 ms 792 KB Correct answer: answer = 71923
27 Correct 2 ms 796 KB Correct answer: answer = 77137
28 Correct 3 ms 844 KB Correct answer: answer = 764
29 Correct 3 ms 848 KB Correct answer: answer = 250000
30 Correct 3 ms 852 KB Correct answer: answer = 500
31 Correct 3 ms 852 KB Correct answer: answer = 32
32 Correct 3 ms 860 KB Correct answer: answer = 130050
33 Correct 4 ms 864 KB Correct answer: answer = 5110
34 Correct 3 ms 868 KB Correct answer: answer = 2626
35 Correct 3 ms 872 KB Correct answer: answer = 796
36 Correct 3 ms 876 KB Correct answer: answer = 7580
37 Correct 3 ms 880 KB Correct answer: answer = 1904
38 Correct 3 ms 884 KB Correct answer: answer = 996004
39 Correct 4 ms 888 KB Correct answer: answer = 38817
40 Correct 3 ms 892 KB Correct answer: answer = 4096
41 Correct 3 ms 896 KB Correct answer: answer = 1
42 Correct 3 ms 900 KB Correct answer: answer = 1
43 Correct 3 ms 908 KB Correct answer: answer = 2040
44 Correct 2 ms 908 KB Correct answer: answer = 2
45 Correct 3 ms 908 KB Correct answer: answer = 4
46 Correct 2 ms 916 KB Correct answer: answer = 9
47 Correct 2 ms 916 KB Correct answer: answer = 9
48 Correct 2 ms 916 KB Correct answer: answer = 21
49 Correct 2 ms 928 KB Correct answer: answer = 71
50 Correct 2 ms 928 KB Correct answer: answer = 77
51 Correct 2 ms 936 KB Correct answer: answer = 400
52 Correct 2 ms 940 KB Correct answer: answer = 996004
53 Correct 2 ms 1052 KB Correct answer: answer = 997310
54 Correct 2 ms 1052 KB Correct answer: answer = 990781
55 Correct 2 ms 1052 KB Correct answer: answer = 996545
56 Correct 2 ms 1052 KB Correct answer: answer = 484
57 Correct 3 ms 1052 KB Correct answer: answer = 484
58 Correct 4 ms 1052 KB Correct answer: answer = 63501
59 Correct 4 ms 1052 KB Correct answer: answer = 323501
60 Correct 3 ms 1052 KB Correct answer: answer = 752500
61 Correct 3 ms 1052 KB Correct answer: answer = 761480
62 Correct 3 ms 1052 KB Correct answer: answer = 758932
63 Correct 2 ms 1052 KB Correct answer: answer = 1000000
64 Correct 3 ms 1052 KB Correct answer: answer = 750500
65 Correct 2 ms 1052 KB Correct answer: answer = 1000000
66 Correct 3 ms 1052 KB Correct answer: answer = 250000
67 Correct 3 ms 1052 KB Correct answer: answer = 250000
68 Correct 2 ms 1052 KB Correct answer: answer = 1000000
69 Correct 3 ms 1052 KB Correct answer: answer = 994009
70 Correct 3 ms 1052 KB Correct answer: answer = 59315
71 Correct 3 ms 1052 KB Correct answer: answer = 25454
72 Correct 4 ms 1052 KB Correct answer: answer = 1504
73 Correct 3 ms 1052 KB Correct answer: answer = 37486
74 Correct 3 ms 1156 KB Correct answer: answer = 4284
75 Correct 3 ms 1156 KB Correct answer: answer = 158008
76 Correct 2 ms 1156 KB Correct answer: answer = 51860
77 Correct 3 ms 1156 KB Correct answer: answer = 12985
78 Correct 5 ms 1308 KB Correct answer: answer = 997864126212
79 Correct 6 ms 1492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 1656 KB Correct answer: answer = 995265560477
81 Correct 10 ms 1756 KB Correct answer: answer = 10125000
82 Correct 10 ms 1796 KB Correct answer: answer = 2291668
83 Correct 7 ms 1796 KB Correct answer: answer = 42388
84 Correct 6 ms 1828 KB Correct answer: answer = 10318
85 Correct 8 ms 1892 KB Correct answer: answer = 3416
86 Correct 12 ms 1944 KB Correct answer: answer = 331708193881
87 Correct 12 ms 2000 KB Correct answer: answer = 2861193756
88 Correct 11 ms 2072 KB Correct answer: answer = 114646930
89 Correct 10 ms 2144 KB Correct answer: answer = 9280921
90 Correct 11 ms 2188 KB Correct answer: answer = 999984053400
91 Correct 12 ms 2216 KB Correct answer: answer = 750935949134
92 Correct 4 ms 2216 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 2352 KB Correct answer: answer = 998762383161
94 Correct 11 ms 2408 KB Correct answer: answer = 23017412908
95 Correct 5 ms 2464 KB Correct answer: answer = 728143410622
96 Correct 5 ms 2464 KB Correct answer: answer = 2
97 Correct 9 ms 2612 KB Correct answer: answer = 1824916
98 Correct 10 ms 2612 KB Correct answer: answer = 10680029
99 Correct 11 ms 2632 KB Correct answer: answer = 18351700
100 Correct 8 ms 2800 KB Correct answer: answer = 16040026
101 Correct 6 ms 2800 KB Correct answer: answer = 253968628325
102 Correct 6 ms 2800 KB Correct answer: answer = 10267
103 Correct 10 ms 2816 KB Correct answer: answer = 2582408
104 Correct 4 ms 2816 KB Correct answer: answer = 78024964781
105 Correct 5 ms 2836 KB Correct answer: answer = 9866346457
106 Correct 5 ms 2836 KB Correct answer: answer = 3327720949
107 Correct 6 ms 2876 KB Correct answer: answer = 86064128360
108 Correct 6 ms 2944 KB Correct answer: answer = 12698259150
109 Correct 9 ms 3132 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 508 KB Correct answer: answer = 4
3 Correct 2 ms 508 KB Correct answer: answer = 4
4 Correct 2 ms 508 KB Correct answer: answer = 12
5 Correct 2 ms 508 KB Correct answer: answer = 52
6 Correct 2 ms 560 KB Correct answer: answer = 210
7 Correct 2 ms 576 KB Correct answer: answer = 88
8 Correct 2 ms 608 KB Correct answer: answer = 7696
9 Correct 2 ms 656 KB Correct answer: answer = 1
10 Correct 2 ms 660 KB Correct answer: answer = 2374
11 Correct 2 ms 668 KB Correct answer: answer = 9502
12 Correct 3 ms 792 KB Correct answer: answer = 49
13 Correct 3 ms 792 KB Correct answer: answer = 151
14 Correct 3 ms 792 KB Correct answer: answer = 7550
15 Correct 4 ms 792 KB Correct answer: answer = 7220
16 Correct 3 ms 792 KB Correct answer: answer = 7550
17 Correct 2 ms 792 KB Correct answer: answer = 10000
18 Correct 3 ms 792 KB Correct answer: answer = 10000
19 Correct 2 ms 792 KB Correct answer: answer = 624
20 Correct 2 ms 792 KB Correct answer: answer = 10000
21 Correct 2 ms 792 KB Correct answer: answer = 1
22 Correct 2 ms 792 KB Correct answer: answer = 4
23 Correct 2 ms 792 KB Correct answer: answer = 1
24 Correct 2 ms 792 KB Correct answer: answer = 5
25 Correct 2 ms 792 KB Correct answer: answer = 41
26 Correct 3 ms 792 KB Correct answer: answer = 71923
27 Correct 2 ms 796 KB Correct answer: answer = 77137
28 Correct 3 ms 844 KB Correct answer: answer = 764
29 Correct 3 ms 848 KB Correct answer: answer = 250000
30 Correct 3 ms 852 KB Correct answer: answer = 500
31 Correct 3 ms 852 KB Correct answer: answer = 32
32 Correct 3 ms 860 KB Correct answer: answer = 130050
33 Correct 4 ms 864 KB Correct answer: answer = 5110
34 Correct 3 ms 868 KB Correct answer: answer = 2626
35 Correct 3 ms 872 KB Correct answer: answer = 796
36 Correct 3 ms 876 KB Correct answer: answer = 7580
37 Correct 3 ms 880 KB Correct answer: answer = 1904
38 Correct 3 ms 884 KB Correct answer: answer = 996004
39 Correct 4 ms 888 KB Correct answer: answer = 38817
40 Correct 3 ms 892 KB Correct answer: answer = 4096
41 Correct 3 ms 896 KB Correct answer: answer = 1
42 Correct 3 ms 900 KB Correct answer: answer = 1
43 Correct 3 ms 908 KB Correct answer: answer = 2040
44 Correct 2 ms 908 KB Correct answer: answer = 2
45 Correct 3 ms 908 KB Correct answer: answer = 4
46 Correct 2 ms 916 KB Correct answer: answer = 9
47 Correct 2 ms 916 KB Correct answer: answer = 9
48 Correct 2 ms 916 KB Correct answer: answer = 21
49 Correct 2 ms 928 KB Correct answer: answer = 71
50 Correct 2 ms 928 KB Correct answer: answer = 77
51 Correct 2 ms 936 KB Correct answer: answer = 400
52 Correct 2 ms 940 KB Correct answer: answer = 996004
53 Correct 2 ms 1052 KB Correct answer: answer = 997310
54 Correct 2 ms 1052 KB Correct answer: answer = 990781
55 Correct 2 ms 1052 KB Correct answer: answer = 996545
56 Correct 2 ms 1052 KB Correct answer: answer = 484
57 Correct 3 ms 1052 KB Correct answer: answer = 484
58 Correct 4 ms 1052 KB Correct answer: answer = 63501
59 Correct 4 ms 1052 KB Correct answer: answer = 323501
60 Correct 3 ms 1052 KB Correct answer: answer = 752500
61 Correct 3 ms 1052 KB Correct answer: answer = 761480
62 Correct 3 ms 1052 KB Correct answer: answer = 758932
63 Correct 2 ms 1052 KB Correct answer: answer = 1000000
64 Correct 3 ms 1052 KB Correct answer: answer = 750500
65 Correct 2 ms 1052 KB Correct answer: answer = 1000000
66 Correct 3 ms 1052 KB Correct answer: answer = 250000
67 Correct 3 ms 1052 KB Correct answer: answer = 250000
68 Correct 2 ms 1052 KB Correct answer: answer = 1000000
69 Correct 3 ms 1052 KB Correct answer: answer = 994009
70 Correct 3 ms 1052 KB Correct answer: answer = 59315
71 Correct 3 ms 1052 KB Correct answer: answer = 25454
72 Correct 4 ms 1052 KB Correct answer: answer = 1504
73 Correct 3 ms 1052 KB Correct answer: answer = 37486
74 Correct 3 ms 1156 KB Correct answer: answer = 4284
75 Correct 3 ms 1156 KB Correct answer: answer = 158008
76 Correct 2 ms 1156 KB Correct answer: answer = 51860
77 Correct 3 ms 1156 KB Correct answer: answer = 12985
78 Correct 5 ms 1308 KB Correct answer: answer = 997864126212
79 Correct 6 ms 1492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 1656 KB Correct answer: answer = 995265560477
81 Correct 10 ms 1756 KB Correct answer: answer = 10125000
82 Correct 10 ms 1796 KB Correct answer: answer = 2291668
83 Correct 7 ms 1796 KB Correct answer: answer = 42388
84 Correct 6 ms 1828 KB Correct answer: answer = 10318
85 Correct 8 ms 1892 KB Correct answer: answer = 3416
86 Correct 12 ms 1944 KB Correct answer: answer = 331708193881
87 Correct 12 ms 2000 KB Correct answer: answer = 2861193756
88 Correct 11 ms 2072 KB Correct answer: answer = 114646930
89 Correct 10 ms 2144 KB Correct answer: answer = 9280921
90 Correct 11 ms 2188 KB Correct answer: answer = 999984053400
91 Correct 12 ms 2216 KB Correct answer: answer = 750935949134
92 Correct 4 ms 2216 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 2352 KB Correct answer: answer = 998762383161
94 Correct 11 ms 2408 KB Correct answer: answer = 23017412908
95 Correct 5 ms 2464 KB Correct answer: answer = 728143410622
96 Correct 5 ms 2464 KB Correct answer: answer = 2
97 Correct 9 ms 2612 KB Correct answer: answer = 1824916
98 Correct 10 ms 2612 KB Correct answer: answer = 10680029
99 Correct 11 ms 2632 KB Correct answer: answer = 18351700
100 Correct 8 ms 2800 KB Correct answer: answer = 16040026
101 Correct 6 ms 2800 KB Correct answer: answer = 253968628325
102 Correct 6 ms 2800 KB Correct answer: answer = 10267
103 Correct 10 ms 2816 KB Correct answer: answer = 2582408
104 Correct 4 ms 2816 KB Correct answer: answer = 78024964781
105 Correct 5 ms 2836 KB Correct answer: answer = 9866346457
106 Correct 5 ms 2836 KB Correct answer: answer = 3327720949
107 Correct 6 ms 2876 KB Correct answer: answer = 86064128360
108 Correct 6 ms 2944 KB Correct answer: answer = 12698259150
109 Correct 9 ms 3132 KB Correct answer: answer = 1185259288
110 Correct 37 ms 5468 KB Correct answer: answer = 999889968863
111 Correct 27 ms 6144 KB Correct answer: answer = 999861384931
112 Correct 25 ms 6856 KB Correct answer: answer = 999811809929
113 Correct 42 ms 7564 KB Correct answer: answer = 999869756441
114 Correct 84 ms 9808 KB Correct answer: answer = 1700000000
115 Correct 98 ms 10380 KB Correct answer: answer = 131666670
116 Correct 24 ms 10380 KB Correct answer: answer = 89478486
117 Correct 30 ms 10380 KB Correct answer: answer = 4971040
118 Correct 24 ms 10380 KB Correct answer: answer = 2711494
119 Correct 81 ms 11516 KB Correct answer: answer = 25252530
120 Correct 74 ms 12100 KB Correct answer: answer = 62500000
121 Correct 104 ms 12284 KB Correct answer: answer = 333175097780
122 Correct 130 ms 12960 KB Correct answer: answer = 33121180179
123 Correct 118 ms 13632 KB Correct answer: answer = 9802314015
124 Correct 86 ms 14696 KB Correct answer: answer = 32567551
125 Correct 125 ms 15264 KB Correct answer: answer = 997525000000
126 Correct 104 ms 15520 KB Correct answer: answer = 752723538884
127 Correct 19 ms 15520 KB Correct answer: answer = 1000000000000
128 Correct 27 ms 15528 KB Correct answer: answer = 999978000121
129 Correct 26 ms 16244 KB Correct answer: answer = 745986144735
130 Correct 16 ms 16364 KB Correct answer: answer = 2
131 Correct 90 ms 18860 KB Correct answer: answer = 277966670
132 Correct 84 ms 19384 KB Correct answer: answer = 2500900082
133 Correct 33 ms 19384 KB Correct answer: answer = 301248349636
134 Correct 66 ms 19384 KB Correct answer: answer = 14118891
135 Correct 24 ms 19384 KB Correct answer: answer = 14384977265
136 Correct 28 ms 19788 KB Correct answer: answer = 3681368330
137 Correct 26 ms 20456 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 508 KB Correct answer: answer = 4
3 Correct 2 ms 508 KB Correct answer: answer = 4
4 Correct 2 ms 508 KB Correct answer: answer = 12
5 Correct 2 ms 508 KB Correct answer: answer = 52
6 Correct 2 ms 560 KB Correct answer: answer = 210
7 Correct 2 ms 576 KB Correct answer: answer = 88
8 Correct 2 ms 608 KB Correct answer: answer = 7696
9 Correct 2 ms 656 KB Correct answer: answer = 1
10 Correct 2 ms 660 KB Correct answer: answer = 2374
11 Correct 2 ms 668 KB Correct answer: answer = 9502
12 Correct 3 ms 792 KB Correct answer: answer = 49
13 Correct 3 ms 792 KB Correct answer: answer = 151
14 Correct 3 ms 792 KB Correct answer: answer = 7550
15 Correct 4 ms 792 KB Correct answer: answer = 7220
16 Correct 3 ms 792 KB Correct answer: answer = 7550
17 Correct 2 ms 792 KB Correct answer: answer = 10000
18 Correct 3 ms 792 KB Correct answer: answer = 10000
19 Correct 2 ms 792 KB Correct answer: answer = 624
20 Correct 2 ms 792 KB Correct answer: answer = 10000
21 Correct 2 ms 792 KB Correct answer: answer = 1
22 Correct 2 ms 792 KB Correct answer: answer = 4
23 Correct 2 ms 792 KB Correct answer: answer = 1
24 Correct 2 ms 792 KB Correct answer: answer = 5
25 Correct 2 ms 792 KB Correct answer: answer = 41
26 Correct 3 ms 792 KB Correct answer: answer = 71923
27 Correct 2 ms 796 KB Correct answer: answer = 77137
28 Correct 3 ms 844 KB Correct answer: answer = 764
29 Correct 3 ms 848 KB Correct answer: answer = 250000
30 Correct 3 ms 852 KB Correct answer: answer = 500
31 Correct 3 ms 852 KB Correct answer: answer = 32
32 Correct 3 ms 860 KB Correct answer: answer = 130050
33 Correct 4 ms 864 KB Correct answer: answer = 5110
34 Correct 3 ms 868 KB Correct answer: answer = 2626
35 Correct 3 ms 872 KB Correct answer: answer = 796
36 Correct 3 ms 876 KB Correct answer: answer = 7580
37 Correct 3 ms 880 KB Correct answer: answer = 1904
38 Correct 3 ms 884 KB Correct answer: answer = 996004
39 Correct 4 ms 888 KB Correct answer: answer = 38817
40 Correct 3 ms 892 KB Correct answer: answer = 4096
41 Correct 3 ms 896 KB Correct answer: answer = 1
42 Correct 3 ms 900 KB Correct answer: answer = 1
43 Correct 3 ms 908 KB Correct answer: answer = 2040
44 Correct 2 ms 908 KB Correct answer: answer = 2
45 Correct 3 ms 908 KB Correct answer: answer = 4
46 Correct 2 ms 916 KB Correct answer: answer = 9
47 Correct 2 ms 916 KB Correct answer: answer = 9
48 Correct 2 ms 916 KB Correct answer: answer = 21
49 Correct 2 ms 928 KB Correct answer: answer = 71
50 Correct 2 ms 928 KB Correct answer: answer = 77
51 Correct 2 ms 936 KB Correct answer: answer = 400
52 Correct 2 ms 940 KB Correct answer: answer = 996004
53 Correct 2 ms 1052 KB Correct answer: answer = 997310
54 Correct 2 ms 1052 KB Correct answer: answer = 990781
55 Correct 2 ms 1052 KB Correct answer: answer = 996545
56 Correct 2 ms 1052 KB Correct answer: answer = 484
57 Correct 3 ms 1052 KB Correct answer: answer = 484
58 Correct 4 ms 1052 KB Correct answer: answer = 63501
59 Correct 4 ms 1052 KB Correct answer: answer = 323501
60 Correct 3 ms 1052 KB Correct answer: answer = 752500
61 Correct 3 ms 1052 KB Correct answer: answer = 761480
62 Correct 3 ms 1052 KB Correct answer: answer = 758932
63 Correct 2 ms 1052 KB Correct answer: answer = 1000000
64 Correct 3 ms 1052 KB Correct answer: answer = 750500
65 Correct 2 ms 1052 KB Correct answer: answer = 1000000
66 Correct 3 ms 1052 KB Correct answer: answer = 250000
67 Correct 3 ms 1052 KB Correct answer: answer = 250000
68 Correct 2 ms 1052 KB Correct answer: answer = 1000000
69 Correct 3 ms 1052 KB Correct answer: answer = 994009
70 Correct 3 ms 1052 KB Correct answer: answer = 59315
71 Correct 3 ms 1052 KB Correct answer: answer = 25454
72 Correct 4 ms 1052 KB Correct answer: answer = 1504
73 Correct 3 ms 1052 KB Correct answer: answer = 37486
74 Correct 3 ms 1156 KB Correct answer: answer = 4284
75 Correct 3 ms 1156 KB Correct answer: answer = 158008
76 Correct 2 ms 1156 KB Correct answer: answer = 51860
77 Correct 3 ms 1156 KB Correct answer: answer = 12985
78 Correct 5 ms 1308 KB Correct answer: answer = 997864126212
79 Correct 6 ms 1492 KB Correct answer: answer = 998608411647
80 Correct 5 ms 1656 KB Correct answer: answer = 995265560477
81 Correct 10 ms 1756 KB Correct answer: answer = 10125000
82 Correct 10 ms 1796 KB Correct answer: answer = 2291668
83 Correct 7 ms 1796 KB Correct answer: answer = 42388
84 Correct 6 ms 1828 KB Correct answer: answer = 10318
85 Correct 8 ms 1892 KB Correct answer: answer = 3416
86 Correct 12 ms 1944 KB Correct answer: answer = 331708193881
87 Correct 12 ms 2000 KB Correct answer: answer = 2861193756
88 Correct 11 ms 2072 KB Correct answer: answer = 114646930
89 Correct 10 ms 2144 KB Correct answer: answer = 9280921
90 Correct 11 ms 2188 KB Correct answer: answer = 999984053400
91 Correct 12 ms 2216 KB Correct answer: answer = 750935949134
92 Correct 4 ms 2216 KB Correct answer: answer = 1000000000000
93 Correct 6 ms 2352 KB Correct answer: answer = 998762383161
94 Correct 11 ms 2408 KB Correct answer: answer = 23017412908
95 Correct 5 ms 2464 KB Correct answer: answer = 728143410622
96 Correct 5 ms 2464 KB Correct answer: answer = 2
97 Correct 9 ms 2612 KB Correct answer: answer = 1824916
98 Correct 10 ms 2612 KB Correct answer: answer = 10680029
99 Correct 11 ms 2632 KB Correct answer: answer = 18351700
100 Correct 8 ms 2800 KB Correct answer: answer = 16040026
101 Correct 6 ms 2800 KB Correct answer: answer = 253968628325
102 Correct 6 ms 2800 KB Correct answer: answer = 10267
103 Correct 10 ms 2816 KB Correct answer: answer = 2582408
104 Correct 4 ms 2816 KB Correct answer: answer = 78024964781
105 Correct 5 ms 2836 KB Correct answer: answer = 9866346457
106 Correct 5 ms 2836 KB Correct answer: answer = 3327720949
107 Correct 6 ms 2876 KB Correct answer: answer = 86064128360
108 Correct 6 ms 2944 KB Correct answer: answer = 12698259150
109 Correct 9 ms 3132 KB Correct answer: answer = 1185259288
110 Correct 37 ms 5468 KB Correct answer: answer = 999889968863
111 Correct 27 ms 6144 KB Correct answer: answer = 999861384931
112 Correct 25 ms 6856 KB Correct answer: answer = 999811809929
113 Correct 42 ms 7564 KB Correct answer: answer = 999869756441
114 Correct 84 ms 9808 KB Correct answer: answer = 1700000000
115 Correct 98 ms 10380 KB Correct answer: answer = 131666670
116 Correct 24 ms 10380 KB Correct answer: answer = 89478486
117 Correct 30 ms 10380 KB Correct answer: answer = 4971040
118 Correct 24 ms 10380 KB Correct answer: answer = 2711494
119 Correct 81 ms 11516 KB Correct answer: answer = 25252530
120 Correct 74 ms 12100 KB Correct answer: answer = 62500000
121 Correct 104 ms 12284 KB Correct answer: answer = 333175097780
122 Correct 130 ms 12960 KB Correct answer: answer = 33121180179
123 Correct 118 ms 13632 KB Correct answer: answer = 9802314015
124 Correct 86 ms 14696 KB Correct answer: answer = 32567551
125 Correct 125 ms 15264 KB Correct answer: answer = 997525000000
126 Correct 104 ms 15520 KB Correct answer: answer = 752723538884
127 Correct 19 ms 15520 KB Correct answer: answer = 1000000000000
128 Correct 27 ms 15528 KB Correct answer: answer = 999978000121
129 Correct 26 ms 16244 KB Correct answer: answer = 745986144735
130 Correct 16 ms 16364 KB Correct answer: answer = 2
131 Correct 90 ms 18860 KB Correct answer: answer = 277966670
132 Correct 84 ms 19384 KB Correct answer: answer = 2500900082
133 Correct 33 ms 19384 KB Correct answer: answer = 301248349636
134 Correct 66 ms 19384 KB Correct answer: answer = 14118891
135 Correct 24 ms 19384 KB Correct answer: answer = 14384977265
136 Correct 28 ms 19788 KB Correct answer: answer = 3681368330
137 Correct 26 ms 20456 KB Correct answer: answer = 2720316816
138 Correct 46 ms 23700 KB Correct answer: answer = 999976000144
139 Correct 70 ms 25024 KB Correct answer: answer = 999856102410
140 Correct 49 ms 26396 KB Correct answer: answer = 999958401531
141 Correct 48 ms 27632 KB Correct answer: answer = 999769649944
142 Correct 48 ms 29108 KB Correct answer: answer = 999874525918
143 Correct 169 ms 33776 KB Correct answer: answer = 6050000000
144 Correct 198 ms 35076 KB Correct answer: answer = 1112500000
145 Correct 82 ms 35076 KB Correct answer: answer = 4294967296
146 Correct 130 ms 35076 KB Correct answer: answer = 87652406
147 Correct 121 ms 35076 KB Correct answer: answer = 6297664
148 Correct 108 ms 35536 KB Correct answer: answer = 196612
149 Correct 236 ms 39368 KB Correct answer: answer = 15015100
150 Correct 167 ms 40316 KB Correct answer: answer = 25000000
151 Correct 238 ms 40572 KB Correct answer: answer = 333230209550
152 Correct 229 ms 41936 KB Correct answer: answer = 917123769
153 Correct 217 ms 43300 KB Correct answer: answer = 95162
154 Correct 190 ms 45672 KB Correct answer: answer = 382616191
155 Correct 201 ms 46776 KB Correct answer: answer = 990033333400
156 Correct 179 ms 48088 KB Correct answer: answer = 990000100000
157 Correct 198 ms 48328 KB Correct answer: answer = 749998188180
158 Correct 33 ms 48328 KB Correct answer: answer = 1000000000000
159 Correct 43 ms 48380 KB Correct answer: answer = 999988000036
160 Correct 49 ms 49728 KB Correct answer: answer = 744929274393
161 Correct 23 ms 50180 KB Correct answer: answer = 2
162 Correct 157 ms 54932 KB Correct answer: answer = 1300024
163 Correct 158 ms 56084 KB Correct answer: answer = 5000700010
164 Correct 62 ms 56084 KB Correct answer: answer = 354997100800
165 Correct 97 ms 56084 KB Correct answer: answer = 257000
166 Correct 95 ms 56084 KB Correct answer: answer = 3765323
167 Correct 92 ms 56084 KB Correct answer: answer = 1525903
168 Correct 43 ms 57068 KB Correct answer: answer = 67618137730
169 Correct 44 ms 58436 KB Correct answer: answer = 12656680171
170 Correct 49 ms 59808 KB Correct answer: answer = 579831736
171 Correct 102 ms 62564 KB Correct answer: answer = 23605611
172 Correct 55 ms 62564 KB Correct answer: answer = 7052481200
173 Correct 57 ms 63868 KB Correct answer: answer = 1314039500
174 Correct 67 ms 65728 KB Correct answer: answer = 302484000
175 Correct 118 ms 68740 KB Correct answer: answer = 52348480