답안 #394278

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394278 2021-04-26T10:32:02 Z Drew_ Aliens (IOI16_aliens) C++14
60 / 100
2000 ms 8652 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 pl pair<ll, ll>
#define f1 first
#define s2 second

const int MAX = 1e5 + 7;

struct Line
{
	ll m, c;
	Line() : m(0), c(0) {}
	Line(ll m, ll c) : m(m), c(c) {}
	double inter(const Line &other) { return (double) (c - other.c) / (other.m - m); }
};

struct convex_hull
{
	int sz = 0;
	Line ar[MAX];

	void clear() { sz = 0; }
	bool cmp(Line a, Line b, Line c) { return a.inter(b) < b.inter(c); }
	void addLine(ll m, ll c)
	{
		Line L(m, c);
		while (sz >= 2 && !cmp(ar[sz-2], ar[sz-1], L))
			sz--;
		ar[sz++] = L;
	}

	ll query(ll x)
	{
		int l = 0, r = sz-1;
		while (l < r)
		{
			int mid = (l + r) / 2;
			if (ar[mid].inter(ar[mid+1]) >= x) r = mid;
			else l = mid + 1;
		}
		return ar[l].m * x + ar[l].c;
	}
} cht;

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

ll dp[2][MAX];
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);
	});

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

	for (int i = 0; i < ivl.size(); ++i)
		dp[0][i] = (ivl[i].s2 - ivl[0].f1) * (ivl[i].s2 - ivl[0].f1);

	k = min(k, (int)ivl.size());
	for (int j = 1; j < k; ++j)
	{
		cht.clear();
		cht.addLine(-2 * ivl[0].f1, ivl[0].f1 * ivl[0].f1);

		dp[j & 1][0] = dp[~j & 1][0];
		for (int i = 1; i < ivl.size(); ++i)
		{
			ll m = -2 * ivl[i].f1;
			ll c = (ivl[i].f1 * ivl[i].f1) + dp[~j & 1][i-1];
			if (ivl[i].f1 < ivl[i-1].s2)
				c -= (ivl[i-1].s2 - ivl[i].f1) * ((ivl[i-1].s2 - ivl[i].f1));
			cht.addLine(m, c);

			dp[j&1][i] = cht.query(ivl[i].s2) + (ivl[i].s2) * (ivl[i].s2);
		}
	}

	return dp[~k & 1][ivl.size() - 1];
	/*
	ll L = 0, R = 1e12;
	for (int i = 0; i < ivl.size(); ++i)
		L = max(L, getCost(i, i));
	k = min(k, (int)ivl.size());
	while (L < R)
	{
		ll mid = (L + R) / 2;
		pl res = check(mid);

		if (res.f1 <= k) R = mid;
		else L = mid + 1;
	}
	pl res = check(L);
	return k * L + res.s2;
	*/
}

/*
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:87:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 |  for (int i = 0; i < ivl.size(); ++i)
      |                  ~~^~~~~~~~~~~~
aliens.cpp:97:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |   for (int i = 1; i < ivl.size(); ++i)
      |                   ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 4
2 Correct 1 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 4
4 Correct 1 ms 1868 KB Correct answer: answer = 12
5 Correct 1 ms 1868 KB Correct answer: answer = 52
6 Correct 1 ms 1868 KB Correct answer: answer = 210
7 Correct 1 ms 1868 KB Correct answer: answer = 88
8 Correct 1 ms 1868 KB Correct answer: answer = 7696
9 Correct 1 ms 1868 KB Correct answer: answer = 1
10 Correct 1 ms 1868 KB Correct answer: answer = 2374
11 Correct 1 ms 1868 KB Correct answer: answer = 9502
12 Correct 1 ms 1868 KB Correct answer: answer = 49
13 Correct 2 ms 1868 KB Correct answer: answer = 151
14 Correct 1 ms 1872 KB Correct answer: answer = 7550
15 Correct 1 ms 1868 KB Correct answer: answer = 7220
16 Correct 1 ms 1868 KB Correct answer: answer = 7550
17 Correct 2 ms 1872 KB Correct answer: answer = 10000
18 Correct 1 ms 1868 KB Correct answer: answer = 10000
19 Correct 2 ms 1868 KB Correct answer: answer = 624
20 Correct 1 ms 1868 KB Correct answer: answer = 10000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 1
2 Correct 2 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 1
4 Correct 1 ms 1868 KB Correct answer: answer = 5
5 Correct 2 ms 1868 KB Correct answer: answer = 41
6 Correct 1 ms 1872 KB Correct answer: answer = 71923
7 Correct 2 ms 1868 KB Correct answer: answer = 77137
8 Correct 10 ms 1956 KB Correct answer: answer = 764
9 Correct 1 ms 1868 KB Correct answer: answer = 250000
10 Correct 25 ms 1868 KB Correct answer: answer = 500
11 Correct 1 ms 1868 KB Correct answer: answer = 32
12 Correct 2 ms 1868 KB Correct answer: answer = 130050
13 Correct 4 ms 1868 KB Correct answer: answer = 5110
14 Correct 2 ms 1868 KB Correct answer: answer = 2626
15 Correct 3 ms 1868 KB Correct answer: answer = 796
16 Correct 3 ms 1868 KB Correct answer: answer = 7580
17 Correct 9 ms 1996 KB Correct answer: answer = 1904
18 Correct 2 ms 1868 KB Correct answer: answer = 996004
19 Correct 2 ms 1868 KB Correct answer: answer = 38817
20 Correct 6 ms 1868 KB Correct answer: answer = 4096
21 Correct 1 ms 1868 KB Correct answer: answer = 1
22 Correct 1 ms 1868 KB Correct answer: answer = 1
23 Correct 7 ms 1912 KB Correct answer: answer = 2040
24 Correct 2 ms 1868 KB Correct answer: answer = 2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 4
2 Correct 1 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 4
4 Correct 1 ms 1868 KB Correct answer: answer = 12
5 Correct 1 ms 1868 KB Correct answer: answer = 52
6 Correct 1 ms 1868 KB Correct answer: answer = 210
7 Correct 1 ms 1868 KB Correct answer: answer = 88
8 Correct 1 ms 1868 KB Correct answer: answer = 7696
9 Correct 1 ms 1868 KB Correct answer: answer = 1
10 Correct 1 ms 1868 KB Correct answer: answer = 2374
11 Correct 1 ms 1868 KB Correct answer: answer = 9502
12 Correct 1 ms 1868 KB Correct answer: answer = 49
13 Correct 2 ms 1868 KB Correct answer: answer = 151
14 Correct 1 ms 1872 KB Correct answer: answer = 7550
15 Correct 1 ms 1868 KB Correct answer: answer = 7220
16 Correct 1 ms 1868 KB Correct answer: answer = 7550
17 Correct 2 ms 1872 KB Correct answer: answer = 10000
18 Correct 1 ms 1868 KB Correct answer: answer = 10000
19 Correct 2 ms 1868 KB Correct answer: answer = 624
20 Correct 1 ms 1868 KB Correct answer: answer = 10000
21 Correct 1 ms 1868 KB Correct answer: answer = 1
22 Correct 2 ms 1868 KB Correct answer: answer = 4
23 Correct 1 ms 1868 KB Correct answer: answer = 1
24 Correct 1 ms 1868 KB Correct answer: answer = 5
25 Correct 2 ms 1868 KB Correct answer: answer = 41
26 Correct 1 ms 1872 KB Correct answer: answer = 71923
27 Correct 2 ms 1868 KB Correct answer: answer = 77137
28 Correct 10 ms 1956 KB Correct answer: answer = 764
29 Correct 1 ms 1868 KB Correct answer: answer = 250000
30 Correct 25 ms 1868 KB Correct answer: answer = 500
31 Correct 1 ms 1868 KB Correct answer: answer = 32
32 Correct 2 ms 1868 KB Correct answer: answer = 130050
33 Correct 4 ms 1868 KB Correct answer: answer = 5110
34 Correct 2 ms 1868 KB Correct answer: answer = 2626
35 Correct 3 ms 1868 KB Correct answer: answer = 796
36 Correct 3 ms 1868 KB Correct answer: answer = 7580
37 Correct 9 ms 1996 KB Correct answer: answer = 1904
38 Correct 2 ms 1868 KB Correct answer: answer = 996004
39 Correct 2 ms 1868 KB Correct answer: answer = 38817
40 Correct 6 ms 1868 KB Correct answer: answer = 4096
41 Correct 1 ms 1868 KB Correct answer: answer = 1
42 Correct 1 ms 1868 KB Correct answer: answer = 1
43 Correct 7 ms 1912 KB Correct answer: answer = 2040
44 Correct 2 ms 1868 KB Correct answer: answer = 2
45 Correct 1 ms 1868 KB Correct answer: answer = 4
46 Correct 1 ms 1868 KB Correct answer: answer = 9
47 Correct 2 ms 1868 KB Correct answer: answer = 9
48 Correct 2 ms 1764 KB Correct answer: answer = 21
49 Correct 1 ms 1868 KB Correct answer: answer = 71
50 Correct 1 ms 1868 KB Correct answer: answer = 77
51 Correct 1 ms 1868 KB Correct answer: answer = 400
52 Correct 2 ms 1868 KB Correct answer: answer = 996004
53 Correct 2 ms 1868 KB Correct answer: answer = 997310
54 Correct 2 ms 1868 KB Correct answer: answer = 990781
55 Correct 2 ms 1868 KB Correct answer: answer = 996545
56 Correct 2 ms 1868 KB Correct answer: answer = 484
57 Correct 2 ms 1868 KB Correct answer: answer = 484
58 Correct 2 ms 1868 KB Correct answer: answer = 63501
59 Correct 2 ms 1868 KB Correct answer: answer = 323501
60 Correct 6 ms 1908 KB Correct answer: answer = 752500
61 Correct 2 ms 1868 KB Correct answer: answer = 761480
62 Correct 6 ms 1868 KB Correct answer: answer = 758932
63 Correct 2 ms 1868 KB Correct answer: answer = 1000000
64 Correct 24 ms 1868 KB Correct answer: answer = 750500
65 Correct 2 ms 1868 KB Correct answer: answer = 1000000
66 Correct 1 ms 1868 KB Correct answer: answer = 250000
67 Correct 1 ms 1872 KB Correct answer: answer = 250000
68 Correct 2 ms 1864 KB Correct answer: answer = 1000000
69 Correct 2 ms 1860 KB Correct answer: answer = 994009
70 Correct 2 ms 1868 KB Correct answer: answer = 59315
71 Correct 3 ms 1868 KB Correct answer: answer = 25454
72 Correct 5 ms 1868 KB Correct answer: answer = 1504
73 Correct 2 ms 1868 KB Correct answer: answer = 37486
74 Correct 4 ms 1868 KB Correct answer: answer = 4284
75 Correct 2 ms 1868 KB Correct answer: answer = 158008
76 Correct 2 ms 1868 KB Correct answer: answer = 51860
77 Correct 2 ms 1872 KB Correct answer: answer = 12985
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 4
2 Correct 1 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 4
4 Correct 1 ms 1868 KB Correct answer: answer = 12
5 Correct 1 ms 1868 KB Correct answer: answer = 52
6 Correct 1 ms 1868 KB Correct answer: answer = 210
7 Correct 1 ms 1868 KB Correct answer: answer = 88
8 Correct 1 ms 1868 KB Correct answer: answer = 7696
9 Correct 1 ms 1868 KB Correct answer: answer = 1
10 Correct 1 ms 1868 KB Correct answer: answer = 2374
11 Correct 1 ms 1868 KB Correct answer: answer = 9502
12 Correct 1 ms 1868 KB Correct answer: answer = 49
13 Correct 2 ms 1868 KB Correct answer: answer = 151
14 Correct 1 ms 1872 KB Correct answer: answer = 7550
15 Correct 1 ms 1868 KB Correct answer: answer = 7220
16 Correct 1 ms 1868 KB Correct answer: answer = 7550
17 Correct 2 ms 1872 KB Correct answer: answer = 10000
18 Correct 1 ms 1868 KB Correct answer: answer = 10000
19 Correct 2 ms 1868 KB Correct answer: answer = 624
20 Correct 1 ms 1868 KB Correct answer: answer = 10000
21 Correct 1 ms 1868 KB Correct answer: answer = 1
22 Correct 2 ms 1868 KB Correct answer: answer = 4
23 Correct 1 ms 1868 KB Correct answer: answer = 1
24 Correct 1 ms 1868 KB Correct answer: answer = 5
25 Correct 2 ms 1868 KB Correct answer: answer = 41
26 Correct 1 ms 1872 KB Correct answer: answer = 71923
27 Correct 2 ms 1868 KB Correct answer: answer = 77137
28 Correct 10 ms 1956 KB Correct answer: answer = 764
29 Correct 1 ms 1868 KB Correct answer: answer = 250000
30 Correct 25 ms 1868 KB Correct answer: answer = 500
31 Correct 1 ms 1868 KB Correct answer: answer = 32
32 Correct 2 ms 1868 KB Correct answer: answer = 130050
33 Correct 4 ms 1868 KB Correct answer: answer = 5110
34 Correct 2 ms 1868 KB Correct answer: answer = 2626
35 Correct 3 ms 1868 KB Correct answer: answer = 796
36 Correct 3 ms 1868 KB Correct answer: answer = 7580
37 Correct 9 ms 1996 KB Correct answer: answer = 1904
38 Correct 2 ms 1868 KB Correct answer: answer = 996004
39 Correct 2 ms 1868 KB Correct answer: answer = 38817
40 Correct 6 ms 1868 KB Correct answer: answer = 4096
41 Correct 1 ms 1868 KB Correct answer: answer = 1
42 Correct 1 ms 1868 KB Correct answer: answer = 1
43 Correct 7 ms 1912 KB Correct answer: answer = 2040
44 Correct 2 ms 1868 KB Correct answer: answer = 2
45 Correct 1 ms 1868 KB Correct answer: answer = 4
46 Correct 1 ms 1868 KB Correct answer: answer = 9
47 Correct 2 ms 1868 KB Correct answer: answer = 9
48 Correct 2 ms 1764 KB Correct answer: answer = 21
49 Correct 1 ms 1868 KB Correct answer: answer = 71
50 Correct 1 ms 1868 KB Correct answer: answer = 77
51 Correct 1 ms 1868 KB Correct answer: answer = 400
52 Correct 2 ms 1868 KB Correct answer: answer = 996004
53 Correct 2 ms 1868 KB Correct answer: answer = 997310
54 Correct 2 ms 1868 KB Correct answer: answer = 990781
55 Correct 2 ms 1868 KB Correct answer: answer = 996545
56 Correct 2 ms 1868 KB Correct answer: answer = 484
57 Correct 2 ms 1868 KB Correct answer: answer = 484
58 Correct 2 ms 1868 KB Correct answer: answer = 63501
59 Correct 2 ms 1868 KB Correct answer: answer = 323501
60 Correct 6 ms 1908 KB Correct answer: answer = 752500
61 Correct 2 ms 1868 KB Correct answer: answer = 761480
62 Correct 6 ms 1868 KB Correct answer: answer = 758932
63 Correct 2 ms 1868 KB Correct answer: answer = 1000000
64 Correct 24 ms 1868 KB Correct answer: answer = 750500
65 Correct 2 ms 1868 KB Correct answer: answer = 1000000
66 Correct 1 ms 1868 KB Correct answer: answer = 250000
67 Correct 1 ms 1872 KB Correct answer: answer = 250000
68 Correct 2 ms 1864 KB Correct answer: answer = 1000000
69 Correct 2 ms 1860 KB Correct answer: answer = 994009
70 Correct 2 ms 1868 KB Correct answer: answer = 59315
71 Correct 3 ms 1868 KB Correct answer: answer = 25454
72 Correct 5 ms 1868 KB Correct answer: answer = 1504
73 Correct 2 ms 1868 KB Correct answer: answer = 37486
74 Correct 4 ms 1868 KB Correct answer: answer = 4284
75 Correct 2 ms 1868 KB Correct answer: answer = 158008
76 Correct 2 ms 1868 KB Correct answer: answer = 51860
77 Correct 2 ms 1872 KB Correct answer: answer = 12985
78 Correct 3 ms 2016 KB Correct answer: answer = 997864126212
79 Correct 3 ms 1996 KB Correct answer: answer = 998608411647
80 Correct 3 ms 2016 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2124 KB Correct answer: answer = 10125000
82 Correct 6 ms 2124 KB Correct answer: answer = 2291668
83 Correct 27 ms 2124 KB Correct answer: answer = 42388
84 Correct 100 ms 2012 KB Correct answer: answer = 10318
85 Correct 321 ms 2020 KB Correct answer: answer = 3416
86 Correct 4 ms 2072 KB Correct answer: answer = 331708193881
87 Correct 133 ms 2244 KB Correct answer: answer = 2861193756
88 Correct 792 ms 2192 KB Correct answer: answer = 114646930
89 Correct 31 ms 2064 KB Correct answer: answer = 9280921
90 Correct 160 ms 2180 KB Correct answer: answer = 999984053400
91 Correct 598 ms 2260 KB Correct answer: answer = 750935949134
92 Correct 3 ms 2016 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 1996 KB Correct answer: answer = 998762383161
94 Correct 22 ms 2124 KB Correct answer: answer = 23017412908
95 Correct 3 ms 1996 KB Correct answer: answer = 728143410622
96 Correct 2 ms 1888 KB Correct answer: answer = 2
97 Correct 8 ms 2124 KB Correct answer: answer = 1824916
98 Correct 285 ms 2184 KB Correct answer: answer = 10680029
99 Correct 151 ms 2188 KB Correct answer: answer = 18351700
100 Correct 4 ms 2124 KB Correct answer: answer = 16040026
101 Correct 3 ms 1996 KB Correct answer: answer = 253968628325
102 Correct 246 ms 2016 KB Correct answer: answer = 10267
103 Correct 963 ms 2244 KB Correct answer: answer = 2582408
104 Correct 3 ms 1996 KB Correct answer: answer = 78024964781
105 Correct 3 ms 1956 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2044 KB Correct answer: answer = 3327720949
107 Correct 8 ms 1996 KB Correct answer: answer = 86064128360
108 Correct 64 ms 1996 KB Correct answer: answer = 12698259150
109 Correct 1090 ms 2176 KB Correct answer: answer = 1185259288
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 4
2 Correct 1 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 4
4 Correct 1 ms 1868 KB Correct answer: answer = 12
5 Correct 1 ms 1868 KB Correct answer: answer = 52
6 Correct 1 ms 1868 KB Correct answer: answer = 210
7 Correct 1 ms 1868 KB Correct answer: answer = 88
8 Correct 1 ms 1868 KB Correct answer: answer = 7696
9 Correct 1 ms 1868 KB Correct answer: answer = 1
10 Correct 1 ms 1868 KB Correct answer: answer = 2374
11 Correct 1 ms 1868 KB Correct answer: answer = 9502
12 Correct 1 ms 1868 KB Correct answer: answer = 49
13 Correct 2 ms 1868 KB Correct answer: answer = 151
14 Correct 1 ms 1872 KB Correct answer: answer = 7550
15 Correct 1 ms 1868 KB Correct answer: answer = 7220
16 Correct 1 ms 1868 KB Correct answer: answer = 7550
17 Correct 2 ms 1872 KB Correct answer: answer = 10000
18 Correct 1 ms 1868 KB Correct answer: answer = 10000
19 Correct 2 ms 1868 KB Correct answer: answer = 624
20 Correct 1 ms 1868 KB Correct answer: answer = 10000
21 Correct 1 ms 1868 KB Correct answer: answer = 1
22 Correct 2 ms 1868 KB Correct answer: answer = 4
23 Correct 1 ms 1868 KB Correct answer: answer = 1
24 Correct 1 ms 1868 KB Correct answer: answer = 5
25 Correct 2 ms 1868 KB Correct answer: answer = 41
26 Correct 1 ms 1872 KB Correct answer: answer = 71923
27 Correct 2 ms 1868 KB Correct answer: answer = 77137
28 Correct 10 ms 1956 KB Correct answer: answer = 764
29 Correct 1 ms 1868 KB Correct answer: answer = 250000
30 Correct 25 ms 1868 KB Correct answer: answer = 500
31 Correct 1 ms 1868 KB Correct answer: answer = 32
32 Correct 2 ms 1868 KB Correct answer: answer = 130050
33 Correct 4 ms 1868 KB Correct answer: answer = 5110
34 Correct 2 ms 1868 KB Correct answer: answer = 2626
35 Correct 3 ms 1868 KB Correct answer: answer = 796
36 Correct 3 ms 1868 KB Correct answer: answer = 7580
37 Correct 9 ms 1996 KB Correct answer: answer = 1904
38 Correct 2 ms 1868 KB Correct answer: answer = 996004
39 Correct 2 ms 1868 KB Correct answer: answer = 38817
40 Correct 6 ms 1868 KB Correct answer: answer = 4096
41 Correct 1 ms 1868 KB Correct answer: answer = 1
42 Correct 1 ms 1868 KB Correct answer: answer = 1
43 Correct 7 ms 1912 KB Correct answer: answer = 2040
44 Correct 2 ms 1868 KB Correct answer: answer = 2
45 Correct 1 ms 1868 KB Correct answer: answer = 4
46 Correct 1 ms 1868 KB Correct answer: answer = 9
47 Correct 2 ms 1868 KB Correct answer: answer = 9
48 Correct 2 ms 1764 KB Correct answer: answer = 21
49 Correct 1 ms 1868 KB Correct answer: answer = 71
50 Correct 1 ms 1868 KB Correct answer: answer = 77
51 Correct 1 ms 1868 KB Correct answer: answer = 400
52 Correct 2 ms 1868 KB Correct answer: answer = 996004
53 Correct 2 ms 1868 KB Correct answer: answer = 997310
54 Correct 2 ms 1868 KB Correct answer: answer = 990781
55 Correct 2 ms 1868 KB Correct answer: answer = 996545
56 Correct 2 ms 1868 KB Correct answer: answer = 484
57 Correct 2 ms 1868 KB Correct answer: answer = 484
58 Correct 2 ms 1868 KB Correct answer: answer = 63501
59 Correct 2 ms 1868 KB Correct answer: answer = 323501
60 Correct 6 ms 1908 KB Correct answer: answer = 752500
61 Correct 2 ms 1868 KB Correct answer: answer = 761480
62 Correct 6 ms 1868 KB Correct answer: answer = 758932
63 Correct 2 ms 1868 KB Correct answer: answer = 1000000
64 Correct 24 ms 1868 KB Correct answer: answer = 750500
65 Correct 2 ms 1868 KB Correct answer: answer = 1000000
66 Correct 1 ms 1868 KB Correct answer: answer = 250000
67 Correct 1 ms 1872 KB Correct answer: answer = 250000
68 Correct 2 ms 1864 KB Correct answer: answer = 1000000
69 Correct 2 ms 1860 KB Correct answer: answer = 994009
70 Correct 2 ms 1868 KB Correct answer: answer = 59315
71 Correct 3 ms 1868 KB Correct answer: answer = 25454
72 Correct 5 ms 1868 KB Correct answer: answer = 1504
73 Correct 2 ms 1868 KB Correct answer: answer = 37486
74 Correct 4 ms 1868 KB Correct answer: answer = 4284
75 Correct 2 ms 1868 KB Correct answer: answer = 158008
76 Correct 2 ms 1868 KB Correct answer: answer = 51860
77 Correct 2 ms 1872 KB Correct answer: answer = 12985
78 Correct 3 ms 2016 KB Correct answer: answer = 997864126212
79 Correct 3 ms 1996 KB Correct answer: answer = 998608411647
80 Correct 3 ms 2016 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2124 KB Correct answer: answer = 10125000
82 Correct 6 ms 2124 KB Correct answer: answer = 2291668
83 Correct 27 ms 2124 KB Correct answer: answer = 42388
84 Correct 100 ms 2012 KB Correct answer: answer = 10318
85 Correct 321 ms 2020 KB Correct answer: answer = 3416
86 Correct 4 ms 2072 KB Correct answer: answer = 331708193881
87 Correct 133 ms 2244 KB Correct answer: answer = 2861193756
88 Correct 792 ms 2192 KB Correct answer: answer = 114646930
89 Correct 31 ms 2064 KB Correct answer: answer = 9280921
90 Correct 160 ms 2180 KB Correct answer: answer = 999984053400
91 Correct 598 ms 2260 KB Correct answer: answer = 750935949134
92 Correct 3 ms 2016 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 1996 KB Correct answer: answer = 998762383161
94 Correct 22 ms 2124 KB Correct answer: answer = 23017412908
95 Correct 3 ms 1996 KB Correct answer: answer = 728143410622
96 Correct 2 ms 1888 KB Correct answer: answer = 2
97 Correct 8 ms 2124 KB Correct answer: answer = 1824916
98 Correct 285 ms 2184 KB Correct answer: answer = 10680029
99 Correct 151 ms 2188 KB Correct answer: answer = 18351700
100 Correct 4 ms 2124 KB Correct answer: answer = 16040026
101 Correct 3 ms 1996 KB Correct answer: answer = 253968628325
102 Correct 246 ms 2016 KB Correct answer: answer = 10267
103 Correct 963 ms 2244 KB Correct answer: answer = 2582408
104 Correct 3 ms 1996 KB Correct answer: answer = 78024964781
105 Correct 3 ms 1956 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2044 KB Correct answer: answer = 3327720949
107 Correct 8 ms 1996 KB Correct answer: answer = 86064128360
108 Correct 64 ms 1996 KB Correct answer: answer = 12698259150
109 Correct 1090 ms 2176 KB Correct answer: answer = 1185259288
110 Correct 21 ms 3660 KB Correct answer: answer = 999889968863
111 Correct 19 ms 3736 KB Correct answer: answer = 999861384931
112 Correct 18 ms 3732 KB Correct answer: answer = 999811809929
113 Correct 18 ms 3676 KB Correct answer: answer = 999869756441
114 Correct 29 ms 5312 KB Correct answer: answer = 1700000000
115 Correct 182 ms 5308 KB Correct answer: answer = 131666670
116 Correct 12 ms 3016 KB Correct answer: answer = 89478486
117 Correct 146 ms 3016 KB Correct answer: answer = 4971040
118 Correct 260 ms 3016 KB Correct answer: answer = 2711494
119 Correct 889 ms 5312 KB Correct answer: answer = 25252530
120 Correct 365 ms 5304 KB Correct answer: answer = 62500000
121 Correct 33 ms 5260 KB Correct answer: answer = 333175097780
122 Correct 222 ms 5304 KB Correct answer: answer = 33121180179
123 Correct 787 ms 5384 KB Correct answer: answer = 9802314015
124 Correct 703 ms 5304 KB Correct answer: answer = 32567551
125 Correct 896 ms 5432 KB Correct answer: answer = 997525000000
126 Correct 709 ms 5276 KB Correct answer: answer = 752723538884
127 Correct 15 ms 3660 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 3660 KB Correct answer: answer = 999978000121
129 Correct 22 ms 3704 KB Correct answer: answer = 745986144735
130 Correct 13 ms 3148 KB Correct answer: answer = 2
131 Correct 100 ms 5304 KB Correct answer: answer = 277966670
132 Correct 29 ms 5264 KB Correct answer: answer = 2500900082
133 Correct 18 ms 3916 KB Correct answer: answer = 301248349636
134 Correct 426 ms 3652 KB Correct answer: answer = 14118891
135 Correct 19 ms 3660 KB Correct answer: answer = 14384977265
136 Correct 20 ms 3732 KB Correct answer: answer = 3681368330
137 Correct 25 ms 3640 KB Correct answer: answer = 2720316816
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1868 KB Correct answer: answer = 4
2 Correct 1 ms 1868 KB Correct answer: answer = 4
3 Correct 1 ms 1868 KB Correct answer: answer = 4
4 Correct 1 ms 1868 KB Correct answer: answer = 12
5 Correct 1 ms 1868 KB Correct answer: answer = 52
6 Correct 1 ms 1868 KB Correct answer: answer = 210
7 Correct 1 ms 1868 KB Correct answer: answer = 88
8 Correct 1 ms 1868 KB Correct answer: answer = 7696
9 Correct 1 ms 1868 KB Correct answer: answer = 1
10 Correct 1 ms 1868 KB Correct answer: answer = 2374
11 Correct 1 ms 1868 KB Correct answer: answer = 9502
12 Correct 1 ms 1868 KB Correct answer: answer = 49
13 Correct 2 ms 1868 KB Correct answer: answer = 151
14 Correct 1 ms 1872 KB Correct answer: answer = 7550
15 Correct 1 ms 1868 KB Correct answer: answer = 7220
16 Correct 1 ms 1868 KB Correct answer: answer = 7550
17 Correct 2 ms 1872 KB Correct answer: answer = 10000
18 Correct 1 ms 1868 KB Correct answer: answer = 10000
19 Correct 2 ms 1868 KB Correct answer: answer = 624
20 Correct 1 ms 1868 KB Correct answer: answer = 10000
21 Correct 1 ms 1868 KB Correct answer: answer = 1
22 Correct 2 ms 1868 KB Correct answer: answer = 4
23 Correct 1 ms 1868 KB Correct answer: answer = 1
24 Correct 1 ms 1868 KB Correct answer: answer = 5
25 Correct 2 ms 1868 KB Correct answer: answer = 41
26 Correct 1 ms 1872 KB Correct answer: answer = 71923
27 Correct 2 ms 1868 KB Correct answer: answer = 77137
28 Correct 10 ms 1956 KB Correct answer: answer = 764
29 Correct 1 ms 1868 KB Correct answer: answer = 250000
30 Correct 25 ms 1868 KB Correct answer: answer = 500
31 Correct 1 ms 1868 KB Correct answer: answer = 32
32 Correct 2 ms 1868 KB Correct answer: answer = 130050
33 Correct 4 ms 1868 KB Correct answer: answer = 5110
34 Correct 2 ms 1868 KB Correct answer: answer = 2626
35 Correct 3 ms 1868 KB Correct answer: answer = 796
36 Correct 3 ms 1868 KB Correct answer: answer = 7580
37 Correct 9 ms 1996 KB Correct answer: answer = 1904
38 Correct 2 ms 1868 KB Correct answer: answer = 996004
39 Correct 2 ms 1868 KB Correct answer: answer = 38817
40 Correct 6 ms 1868 KB Correct answer: answer = 4096
41 Correct 1 ms 1868 KB Correct answer: answer = 1
42 Correct 1 ms 1868 KB Correct answer: answer = 1
43 Correct 7 ms 1912 KB Correct answer: answer = 2040
44 Correct 2 ms 1868 KB Correct answer: answer = 2
45 Correct 1 ms 1868 KB Correct answer: answer = 4
46 Correct 1 ms 1868 KB Correct answer: answer = 9
47 Correct 2 ms 1868 KB Correct answer: answer = 9
48 Correct 2 ms 1764 KB Correct answer: answer = 21
49 Correct 1 ms 1868 KB Correct answer: answer = 71
50 Correct 1 ms 1868 KB Correct answer: answer = 77
51 Correct 1 ms 1868 KB Correct answer: answer = 400
52 Correct 2 ms 1868 KB Correct answer: answer = 996004
53 Correct 2 ms 1868 KB Correct answer: answer = 997310
54 Correct 2 ms 1868 KB Correct answer: answer = 990781
55 Correct 2 ms 1868 KB Correct answer: answer = 996545
56 Correct 2 ms 1868 KB Correct answer: answer = 484
57 Correct 2 ms 1868 KB Correct answer: answer = 484
58 Correct 2 ms 1868 KB Correct answer: answer = 63501
59 Correct 2 ms 1868 KB Correct answer: answer = 323501
60 Correct 6 ms 1908 KB Correct answer: answer = 752500
61 Correct 2 ms 1868 KB Correct answer: answer = 761480
62 Correct 6 ms 1868 KB Correct answer: answer = 758932
63 Correct 2 ms 1868 KB Correct answer: answer = 1000000
64 Correct 24 ms 1868 KB Correct answer: answer = 750500
65 Correct 2 ms 1868 KB Correct answer: answer = 1000000
66 Correct 1 ms 1868 KB Correct answer: answer = 250000
67 Correct 1 ms 1872 KB Correct answer: answer = 250000
68 Correct 2 ms 1864 KB Correct answer: answer = 1000000
69 Correct 2 ms 1860 KB Correct answer: answer = 994009
70 Correct 2 ms 1868 KB Correct answer: answer = 59315
71 Correct 3 ms 1868 KB Correct answer: answer = 25454
72 Correct 5 ms 1868 KB Correct answer: answer = 1504
73 Correct 2 ms 1868 KB Correct answer: answer = 37486
74 Correct 4 ms 1868 KB Correct answer: answer = 4284
75 Correct 2 ms 1868 KB Correct answer: answer = 158008
76 Correct 2 ms 1868 KB Correct answer: answer = 51860
77 Correct 2 ms 1872 KB Correct answer: answer = 12985
78 Correct 3 ms 2016 KB Correct answer: answer = 997864126212
79 Correct 3 ms 1996 KB Correct answer: answer = 998608411647
80 Correct 3 ms 2016 KB Correct answer: answer = 995265560477
81 Correct 3 ms 2124 KB Correct answer: answer = 10125000
82 Correct 6 ms 2124 KB Correct answer: answer = 2291668
83 Correct 27 ms 2124 KB Correct answer: answer = 42388
84 Correct 100 ms 2012 KB Correct answer: answer = 10318
85 Correct 321 ms 2020 KB Correct answer: answer = 3416
86 Correct 4 ms 2072 KB Correct answer: answer = 331708193881
87 Correct 133 ms 2244 KB Correct answer: answer = 2861193756
88 Correct 792 ms 2192 KB Correct answer: answer = 114646930
89 Correct 31 ms 2064 KB Correct answer: answer = 9280921
90 Correct 160 ms 2180 KB Correct answer: answer = 999984053400
91 Correct 598 ms 2260 KB Correct answer: answer = 750935949134
92 Correct 3 ms 2016 KB Correct answer: answer = 1000000000000
93 Correct 3 ms 1996 KB Correct answer: answer = 998762383161
94 Correct 22 ms 2124 KB Correct answer: answer = 23017412908
95 Correct 3 ms 1996 KB Correct answer: answer = 728143410622
96 Correct 2 ms 1888 KB Correct answer: answer = 2
97 Correct 8 ms 2124 KB Correct answer: answer = 1824916
98 Correct 285 ms 2184 KB Correct answer: answer = 10680029
99 Correct 151 ms 2188 KB Correct answer: answer = 18351700
100 Correct 4 ms 2124 KB Correct answer: answer = 16040026
101 Correct 3 ms 1996 KB Correct answer: answer = 253968628325
102 Correct 246 ms 2016 KB Correct answer: answer = 10267
103 Correct 963 ms 2244 KB Correct answer: answer = 2582408
104 Correct 3 ms 1996 KB Correct answer: answer = 78024964781
105 Correct 3 ms 1956 KB Correct answer: answer = 9866346457
106 Correct 8 ms 2044 KB Correct answer: answer = 3327720949
107 Correct 8 ms 1996 KB Correct answer: answer = 86064128360
108 Correct 64 ms 1996 KB Correct answer: answer = 12698259150
109 Correct 1090 ms 2176 KB Correct answer: answer = 1185259288
110 Correct 21 ms 3660 KB Correct answer: answer = 999889968863
111 Correct 19 ms 3736 KB Correct answer: answer = 999861384931
112 Correct 18 ms 3732 KB Correct answer: answer = 999811809929
113 Correct 18 ms 3676 KB Correct answer: answer = 999869756441
114 Correct 29 ms 5312 KB Correct answer: answer = 1700000000
115 Correct 182 ms 5308 KB Correct answer: answer = 131666670
116 Correct 12 ms 3016 KB Correct answer: answer = 89478486
117 Correct 146 ms 3016 KB Correct answer: answer = 4971040
118 Correct 260 ms 3016 KB Correct answer: answer = 2711494
119 Correct 889 ms 5312 KB Correct answer: answer = 25252530
120 Correct 365 ms 5304 KB Correct answer: answer = 62500000
121 Correct 33 ms 5260 KB Correct answer: answer = 333175097780
122 Correct 222 ms 5304 KB Correct answer: answer = 33121180179
123 Correct 787 ms 5384 KB Correct answer: answer = 9802314015
124 Correct 703 ms 5304 KB Correct answer: answer = 32567551
125 Correct 896 ms 5432 KB Correct answer: answer = 997525000000
126 Correct 709 ms 5276 KB Correct answer: answer = 752723538884
127 Correct 15 ms 3660 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 3660 KB Correct answer: answer = 999978000121
129 Correct 22 ms 3704 KB Correct answer: answer = 745986144735
130 Correct 13 ms 3148 KB Correct answer: answer = 2
131 Correct 100 ms 5304 KB Correct answer: answer = 277966670
132 Correct 29 ms 5264 KB Correct answer: answer = 2500900082
133 Correct 18 ms 3916 KB Correct answer: answer = 301248349636
134 Correct 426 ms 3652 KB Correct answer: answer = 14118891
135 Correct 19 ms 3660 KB Correct answer: answer = 14384977265
136 Correct 20 ms 3732 KB Correct answer: answer = 3681368330
137 Correct 25 ms 3640 KB Correct answer: answer = 2720316816
138 Correct 35 ms 5456 KB Correct answer: answer = 999976000144
139 Correct 41 ms 5444 KB Correct answer: answer = 999856102410
140 Correct 35 ms 5464 KB Correct answer: answer = 999958401531
141 Correct 34 ms 5440 KB Correct answer: answer = 999769649944
142 Correct 34 ms 5460 KB Correct answer: answer = 999874525918
143 Correct 59 ms 8536 KB Correct answer: answer = 6050000000
144 Correct 192 ms 8652 KB Correct answer: answer = 1112500000
145 Correct 18 ms 5824 KB Correct answer: answer = 4294967296
146 Correct 593 ms 6472 KB Correct answer: answer = 87652406
147 Execution timed out 2094 ms 6348 KB Time limit exceeded
148 Halted 0 ms 0 KB -