Submission #390428

# Submission time Handle Problem Language Result Execution time Memory
390428 2021-04-16T04:17:18 Z Drew_ Aliens (IOI16_aliens) C++14
60 / 100
2000 ms 6212 KB
#include "aliens.h"
#include <vector>
#include <iostream>
#include <algorithm>
#include <cassert>
using namespace std;

#define ll long long
#define pb push_back
#define ii pair<int, int>
#define f1 first
#define s2 second

vector<ii> interval;

//cost for interval [i, j], assuming interval [0, i-1] have been fulfilled
inline ll getCost(int i, int j)
{
	ll res = 1LL * (interval[j].s2 - interval[i].f1 + 1) * (interval[j].s2 - interval[i].f1 + 1);
	if (i)
	{
		if (interval[i-1].s2 >= interval[i].f1)
			res -= 1LL * (interval[i-1].s2 - interval[i].f1 + 1) * (interval[i-1].s2 - interval[i].f1 + 1);
	}
	return res;
}

vector<ll> dp[2];
inline void dnc(int k, int l, int r, int optL, int optR)
{
	if (l > r)
		return;

	int mid = (l + r) / 2;

	ll optVal = 1e18;
	int optIdx = -1;
	for (int i = optL; i <= mid && i <= optR; ++i)
	{
		ll val = (i ? dp[(k+1) & 1][i-1] : 0) + getCost(i, mid);
		if (optVal > val)
		{
			optVal = val;
			optIdx = i;
		}
	}

	dp[k&1][mid] = optVal;
	dnc(k, l, mid-1, optL, optIdx);
	dnc(k, mid+1, r, optIdx, optR);
}


long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
	vector<ii> v(n);
	for (int i = 0; i < n; ++i)
		v[i] = {min(r[i], c[i]), max(r[i], c[i])};
	sort(v.begin(), v.end(), [](const ii &x, const ii &y){
		return x.f1 < y.f1 || (x.f1 == y.f1 && x.s2 > y.s2);
	});

	interval.pb(v[0]);
	for (int i = 1; i < n; ++i)
	{
		if (interval.back().f1 <= v[i].f1 && v[i].s2 <= interval.back().s2)
			continue;
		interval.pb(v[i]);
	}

	for (int i = 0; i+1 < interval.size(); ++i)
		assert(interval[i].f1 < interval[i+1].f1 && interval[i].s2 < interval[i+1].s2);

	dp[0].resize(interval.size());
	dp[1].resize(interval.size());


	for (int i = 0; i < interval.size(); ++i)
		dp[1][i] = getCost(0, i);

	for (int j = 2; j <= k; ++j)
		dnc(j, 0, interval.size() - 1, 0, interval.size() - 1);

    return dp[k & 1].back();
}

/*
int main() {
    int n, m, k;
    assert(3 == scanf("%d %d %d", &n, &m, &k));
    std::vector<int> r(n), c(n);
    for (int i = 0; i < n; i++) {
        assert(2 == scanf("%d %d", &r[i], &c[i]));
    }
    long long ans = take_photos(n, m, k, r, c);
    
    
    printf("%lld\n", ans);
    return 0;
}
*/

Compilation message

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:70:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |  for (int i = 0; i+1 < interval.size(); ++i)
      |                  ~~~~^~~~~~~~~~~~~~~~~
aliens.cpp:77:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |  for (int i = 0; i < interval.size(); ++i)
      |                  ~~^~~~~~~~~~~~~~~~~
# 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 0 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 1
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 1
4 Correct 1 ms 204 KB Correct answer: answer = 5
5 Correct 1 ms 204 KB Correct answer: answer = 41
6 Correct 1 ms 204 KB Correct answer: answer = 71923
7 Correct 1 ms 204 KB Correct answer: answer = 77137
8 Correct 3 ms 204 KB Correct answer: answer = 764
9 Correct 1 ms 204 KB Correct answer: answer = 250000
10 Correct 7 ms 328 KB Correct answer: answer = 500
11 Correct 1 ms 204 KB Correct answer: answer = 32
12 Correct 1 ms 296 KB Correct answer: answer = 130050
13 Correct 2 ms 204 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 204 KB Correct answer: answer = 7580
17 Correct 4 ms 204 KB Correct answer: answer = 1904
18 Correct 1 ms 204 KB Correct answer: answer = 996004
19 Correct 1 ms 204 KB Correct answer: answer = 38817
20 Correct 3 ms 208 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 3 ms 292 KB Correct answer: answer = 2040
24 Correct 1 ms 296 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 0 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 3 ms 204 KB Correct answer: answer = 764
29 Correct 1 ms 204 KB Correct answer: answer = 250000
30 Correct 7 ms 328 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 296 KB Correct answer: answer = 130050
33 Correct 2 ms 204 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 204 KB Correct answer: answer = 7580
37 Correct 4 ms 204 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 3 ms 208 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 3 ms 292 KB Correct answer: answer = 2040
44 Correct 1 ms 296 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 292 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 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 296 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 204 KB Correct answer: answer = 63501
59 Correct 1 ms 204 KB Correct answer: answer = 323501
60 Correct 2 ms 204 KB Correct answer: answer = 752500
61 Correct 1 ms 296 KB Correct answer: answer = 761480
62 Correct 2 ms 204 KB Correct answer: answer = 758932
63 Correct 1 ms 296 KB Correct answer: answer = 1000000
64 Correct 8 ms 204 KB Correct answer: answer = 750500
65 Correct 1 ms 292 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 292 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 2 ms 332 KB Correct answer: answer = 25454
72 Correct 3 ms 204 KB Correct answer: answer = 1504
73 Correct 1 ms 204 KB Correct answer: answer = 37486
74 Correct 2 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 0 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 3 ms 204 KB Correct answer: answer = 764
29 Correct 1 ms 204 KB Correct answer: answer = 250000
30 Correct 7 ms 328 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 296 KB Correct answer: answer = 130050
33 Correct 2 ms 204 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 204 KB Correct answer: answer = 7580
37 Correct 4 ms 204 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 3 ms 208 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 3 ms 292 KB Correct answer: answer = 2040
44 Correct 1 ms 296 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 292 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 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 296 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 204 KB Correct answer: answer = 63501
59 Correct 1 ms 204 KB Correct answer: answer = 323501
60 Correct 2 ms 204 KB Correct answer: answer = 752500
61 Correct 1 ms 296 KB Correct answer: answer = 761480
62 Correct 2 ms 204 KB Correct answer: answer = 758932
63 Correct 1 ms 296 KB Correct answer: answer = 1000000
64 Correct 8 ms 204 KB Correct answer: answer = 750500
65 Correct 1 ms 292 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 292 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 2 ms 332 KB Correct answer: answer = 25454
72 Correct 3 ms 204 KB Correct answer: answer = 1504
73 Correct 1 ms 204 KB Correct answer: answer = 37486
74 Correct 2 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 2 ms 436 KB Correct answer: answer = 997864126212
79 Correct 2 ms 384 KB Correct answer: answer = 998608411647
80 Correct 3 ms 332 KB Correct answer: answer = 995265560477
81 Correct 2 ms 484 KB Correct answer: answer = 10125000
82 Correct 3 ms 488 KB Correct answer: answer = 2291668
83 Correct 8 ms 304 KB Correct answer: answer = 42388
84 Correct 26 ms 332 KB Correct answer: answer = 10318
85 Correct 78 ms 416 KB Correct answer: answer = 3416
86 Correct 2 ms 564 KB Correct answer: answer = 331708193881
87 Correct 47 ms 460 KB Correct answer: answer = 2861193756
88 Correct 218 ms 460 KB Correct answer: answer = 114646930
89 Correct 11 ms 460 KB Correct answer: answer = 9280921
90 Correct 47 ms 496 KB Correct answer: answer = 999984053400
91 Correct 212 ms 552 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 444 KB Correct answer: answer = 998762383161
94 Correct 10 ms 564 KB Correct answer: answer = 23017412908
95 Correct 4 ms 412 KB Correct answer: answer = 728143410622
96 Correct 2 ms 288 KB Correct answer: answer = 2
97 Correct 3 ms 464 KB Correct answer: answer = 1824916
98 Correct 78 ms 460 KB Correct answer: answer = 10680029
99 Correct 40 ms 556 KB Correct answer: answer = 18351700
100 Correct 2 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 440 KB Correct answer: answer = 253968628325
102 Correct 112 ms 332 KB Correct answer: answer = 10267
103 Correct 216 ms 460 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 4 ms 332 KB Correct answer: answer = 3327720949
107 Correct 12 ms 332 KB Correct answer: answer = 86064128360
108 Correct 58 ms 460 KB Correct answer: answer = 12698259150
109 Correct 254 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 0 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 3 ms 204 KB Correct answer: answer = 764
29 Correct 1 ms 204 KB Correct answer: answer = 250000
30 Correct 7 ms 328 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 296 KB Correct answer: answer = 130050
33 Correct 2 ms 204 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 204 KB Correct answer: answer = 7580
37 Correct 4 ms 204 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 3 ms 208 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 3 ms 292 KB Correct answer: answer = 2040
44 Correct 1 ms 296 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 292 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 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 296 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 204 KB Correct answer: answer = 63501
59 Correct 1 ms 204 KB Correct answer: answer = 323501
60 Correct 2 ms 204 KB Correct answer: answer = 752500
61 Correct 1 ms 296 KB Correct answer: answer = 761480
62 Correct 2 ms 204 KB Correct answer: answer = 758932
63 Correct 1 ms 296 KB Correct answer: answer = 1000000
64 Correct 8 ms 204 KB Correct answer: answer = 750500
65 Correct 1 ms 292 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 292 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 2 ms 332 KB Correct answer: answer = 25454
72 Correct 3 ms 204 KB Correct answer: answer = 1504
73 Correct 1 ms 204 KB Correct answer: answer = 37486
74 Correct 2 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 2 ms 436 KB Correct answer: answer = 997864126212
79 Correct 2 ms 384 KB Correct answer: answer = 998608411647
80 Correct 3 ms 332 KB Correct answer: answer = 995265560477
81 Correct 2 ms 484 KB Correct answer: answer = 10125000
82 Correct 3 ms 488 KB Correct answer: answer = 2291668
83 Correct 8 ms 304 KB Correct answer: answer = 42388
84 Correct 26 ms 332 KB Correct answer: answer = 10318
85 Correct 78 ms 416 KB Correct answer: answer = 3416
86 Correct 2 ms 564 KB Correct answer: answer = 331708193881
87 Correct 47 ms 460 KB Correct answer: answer = 2861193756
88 Correct 218 ms 460 KB Correct answer: answer = 114646930
89 Correct 11 ms 460 KB Correct answer: answer = 9280921
90 Correct 47 ms 496 KB Correct answer: answer = 999984053400
91 Correct 212 ms 552 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 444 KB Correct answer: answer = 998762383161
94 Correct 10 ms 564 KB Correct answer: answer = 23017412908
95 Correct 4 ms 412 KB Correct answer: answer = 728143410622
96 Correct 2 ms 288 KB Correct answer: answer = 2
97 Correct 3 ms 464 KB Correct answer: answer = 1824916
98 Correct 78 ms 460 KB Correct answer: answer = 10680029
99 Correct 40 ms 556 KB Correct answer: answer = 18351700
100 Correct 2 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 440 KB Correct answer: answer = 253968628325
102 Correct 112 ms 332 KB Correct answer: answer = 10267
103 Correct 216 ms 460 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 4 ms 332 KB Correct answer: answer = 3327720949
107 Correct 12 ms 332 KB Correct answer: answer = 86064128360
108 Correct 58 ms 460 KB Correct answer: answer = 12698259150
109 Correct 254 ms 460 KB Correct answer: answer = 1185259288
110 Correct 17 ms 2144 KB Correct answer: answer = 999889968863
111 Correct 17 ms 2124 KB Correct answer: answer = 999861384931
112 Correct 22 ms 2256 KB Correct answer: answer = 999811809929
113 Correct 18 ms 2112 KB Correct answer: answer = 999869756441
114 Correct 20 ms 3424 KB Correct answer: answer = 1700000000
115 Correct 59 ms 3260 KB Correct answer: answer = 131666670
116 Correct 6 ms 1228 KB Correct answer: answer = 89478486
117 Correct 41 ms 1228 KB Correct answer: answer = 4971040
118 Correct 67 ms 1228 KB Correct answer: answer = 2711494
119 Correct 229 ms 3268 KB Correct answer: answer = 25252530
120 Correct 99 ms 3344 KB Correct answer: answer = 62500000
121 Correct 23 ms 3388 KB Correct answer: answer = 333175097780
122 Correct 95 ms 3420 KB Correct answer: answer = 33121180179
123 Correct 269 ms 3372 KB Correct answer: answer = 9802314015
124 Correct 236 ms 3228 KB Correct answer: answer = 32567551
125 Correct 258 ms 3392 KB Correct answer: answer = 997525000000
126 Correct 276 ms 3260 KB Correct answer: answer = 752723538884
127 Correct 13 ms 1988 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 2124 KB Correct answer: answer = 999978000121
129 Correct 18 ms 2136 KB Correct answer: answer = 745986144735
130 Correct 11 ms 1676 KB Correct answer: answer = 2
131 Correct 43 ms 3308 KB Correct answer: answer = 277966670
132 Correct 21 ms 3320 KB Correct answer: answer = 2500900082
133 Correct 17 ms 2208 KB Correct answer: answer = 301248349636
134 Correct 270 ms 1808 KB Correct answer: answer = 14118891
135 Correct 18 ms 2124 KB Correct answer: answer = 14384977265
136 Correct 19 ms 2088 KB Correct answer: answer = 3681368330
137 Correct 22 ms 2124 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 0 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 204 KB Correct answer: answer = 7696
9 Correct 0 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 1 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 204 KB Correct answer: answer = 77137
28 Correct 3 ms 204 KB Correct answer: answer = 764
29 Correct 1 ms 204 KB Correct answer: answer = 250000
30 Correct 7 ms 328 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 296 KB Correct answer: answer = 130050
33 Correct 2 ms 204 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 204 KB Correct answer: answer = 7580
37 Correct 4 ms 204 KB Correct answer: answer = 1904
38 Correct 1 ms 204 KB Correct answer: answer = 996004
39 Correct 1 ms 204 KB Correct answer: answer = 38817
40 Correct 3 ms 208 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 3 ms 292 KB Correct answer: answer = 2040
44 Correct 1 ms 296 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 292 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 204 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 296 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 204 KB Correct answer: answer = 63501
59 Correct 1 ms 204 KB Correct answer: answer = 323501
60 Correct 2 ms 204 KB Correct answer: answer = 752500
61 Correct 1 ms 296 KB Correct answer: answer = 761480
62 Correct 2 ms 204 KB Correct answer: answer = 758932
63 Correct 1 ms 296 KB Correct answer: answer = 1000000
64 Correct 8 ms 204 KB Correct answer: answer = 750500
65 Correct 1 ms 292 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 292 KB Correct answer: answer = 994009
70 Correct 1 ms 204 KB Correct answer: answer = 59315
71 Correct 2 ms 332 KB Correct answer: answer = 25454
72 Correct 3 ms 204 KB Correct answer: answer = 1504
73 Correct 1 ms 204 KB Correct answer: answer = 37486
74 Correct 2 ms 204 KB Correct answer: answer = 4284
75 Correct 1 ms 204 KB Correct answer: answer = 158008
76 Correct 1 ms 204 KB Correct answer: answer = 51860
77 Correct 1 ms 204 KB Correct answer: answer = 12985
78 Correct 2 ms 436 KB Correct answer: answer = 997864126212
79 Correct 2 ms 384 KB Correct answer: answer = 998608411647
80 Correct 3 ms 332 KB Correct answer: answer = 995265560477
81 Correct 2 ms 484 KB Correct answer: answer = 10125000
82 Correct 3 ms 488 KB Correct answer: answer = 2291668
83 Correct 8 ms 304 KB Correct answer: answer = 42388
84 Correct 26 ms 332 KB Correct answer: answer = 10318
85 Correct 78 ms 416 KB Correct answer: answer = 3416
86 Correct 2 ms 564 KB Correct answer: answer = 331708193881
87 Correct 47 ms 460 KB Correct answer: answer = 2861193756
88 Correct 218 ms 460 KB Correct answer: answer = 114646930
89 Correct 11 ms 460 KB Correct answer: answer = 9280921
90 Correct 47 ms 496 KB Correct answer: answer = 999984053400
91 Correct 212 ms 552 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 444 KB Correct answer: answer = 998762383161
94 Correct 10 ms 564 KB Correct answer: answer = 23017412908
95 Correct 4 ms 412 KB Correct answer: answer = 728143410622
96 Correct 2 ms 288 KB Correct answer: answer = 2
97 Correct 3 ms 464 KB Correct answer: answer = 1824916
98 Correct 78 ms 460 KB Correct answer: answer = 10680029
99 Correct 40 ms 556 KB Correct answer: answer = 18351700
100 Correct 2 ms 460 KB Correct answer: answer = 16040026
101 Correct 2 ms 440 KB Correct answer: answer = 253968628325
102 Correct 112 ms 332 KB Correct answer: answer = 10267
103 Correct 216 ms 460 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 332 KB Correct answer: answer = 9866346457
106 Correct 4 ms 332 KB Correct answer: answer = 3327720949
107 Correct 12 ms 332 KB Correct answer: answer = 86064128360
108 Correct 58 ms 460 KB Correct answer: answer = 12698259150
109 Correct 254 ms 460 KB Correct answer: answer = 1185259288
110 Correct 17 ms 2144 KB Correct answer: answer = 999889968863
111 Correct 17 ms 2124 KB Correct answer: answer = 999861384931
112 Correct 22 ms 2256 KB Correct answer: answer = 999811809929
113 Correct 18 ms 2112 KB Correct answer: answer = 999869756441
114 Correct 20 ms 3424 KB Correct answer: answer = 1700000000
115 Correct 59 ms 3260 KB Correct answer: answer = 131666670
116 Correct 6 ms 1228 KB Correct answer: answer = 89478486
117 Correct 41 ms 1228 KB Correct answer: answer = 4971040
118 Correct 67 ms 1228 KB Correct answer: answer = 2711494
119 Correct 229 ms 3268 KB Correct answer: answer = 25252530
120 Correct 99 ms 3344 KB Correct answer: answer = 62500000
121 Correct 23 ms 3388 KB Correct answer: answer = 333175097780
122 Correct 95 ms 3420 KB Correct answer: answer = 33121180179
123 Correct 269 ms 3372 KB Correct answer: answer = 9802314015
124 Correct 236 ms 3228 KB Correct answer: answer = 32567551
125 Correct 258 ms 3392 KB Correct answer: answer = 997525000000
126 Correct 276 ms 3260 KB Correct answer: answer = 752723538884
127 Correct 13 ms 1988 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 2124 KB Correct answer: answer = 999978000121
129 Correct 18 ms 2136 KB Correct answer: answer = 745986144735
130 Correct 11 ms 1676 KB Correct answer: answer = 2
131 Correct 43 ms 3308 KB Correct answer: answer = 277966670
132 Correct 21 ms 3320 KB Correct answer: answer = 2500900082
133 Correct 17 ms 2208 KB Correct answer: answer = 301248349636
134 Correct 270 ms 1808 KB Correct answer: answer = 14118891
135 Correct 18 ms 2124 KB Correct answer: answer = 14384977265
136 Correct 19 ms 2088 KB Correct answer: answer = 3681368330
137 Correct 22 ms 2124 KB Correct answer: answer = 2720316816
138 Correct 36 ms 3876 KB Correct answer: answer = 999976000144
139 Correct 42 ms 3880 KB Correct answer: answer = 999856102410
140 Correct 35 ms 3888 KB Correct answer: answer = 999958401531
141 Correct 36 ms 3888 KB Correct answer: answer = 999769649944
142 Correct 47 ms 3876 KB Correct answer: answer = 999874525918
143 Correct 40 ms 6176 KB Correct answer: answer = 6050000000
144 Correct 74 ms 6212 KB Correct answer: answer = 1112500000
145 Correct 19 ms 4244 KB Correct answer: answer = 4294967296
146 Correct 164 ms 4272 KB Correct answer: answer = 87652406
147 Correct 1802 ms 4272 KB Correct answer: answer = 6297664
148 Execution timed out 2074 ms 4156 KB Time limit exceeded
149 Halted 0 ms 0 KB -