Submission #579249

# Submission time Handle Problem Language Result Execution time Memory
579249 2022-06-18T15:56:34 Z cheissmart Uplifting Excursion (BOI22_vault) C++14
100 / 100
4372 ms 9172 KB
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

string _reset = "\u001b[0m", _yellow = "\u001b[33m", _bold = "\u001b[1m";
void DBG() { cerr << "]" << _reset << endl; }
template<class H, class...T> void DBG(H h, T ...t) {
	cerr << to_string(h);
	if(sizeof ...(t)) cerr << ", ";
	DBG(t...);
}
#ifdef CHEISSMART
#define debug(...) cerr << _yellow << _bold << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define debug(...)
#endif

const int INF = 1e9 + 7, mxM = 303;

template<class T> void cmax(T& a, T b) { a = max(a, b); }

int m;
ll a[mxM * 2], b[mxM * 2], l;

signed main()
{
	IO_OP;

	cin >> m >> l;
	ll tot = 0, ans = 0;
	for(int i = -m; i <= m; i++) {
		cin >> a[i + m];
		tot += a[i + m] * i;
	}
	if(tot < l) {
		tot = -tot;
		l = -l;
		for(int i = 0; i < m; i++)
			swap(a[i], a[2 * m - i]);
	}
	tot = 0;
	for(int i = -m; i <= 0; i++) {
		tot += a[i + m] * i;
		b[i + m] = a[i + m];
		ans += b[i + m];
	}

	if(tot > l) {
		cout << "impossible\n";
		return 0;
	}
	for(int i = 1; i <= m; i++) {
		assert(tot <= l);
		b[i + m] = min((l - tot) / i, a[i + m]);
		tot += b[i + m] * i;
		ans += b[i + m];
	}
	assert(tot <= l);
	assert(tot + mxM >= l);

	int C = mxM * mxM * 2;
	vi dp(C * 2, -INF);
	dp[0 + C] = 0;

	for(int i = -m; i <= m; i++) {
		if(i == 0) continue;
		vi ndp(C * 2, -INF);
		ll lb = b[i + m] - a[i + m], rb = b[i + m];
		auto go = [&] (vi pos) {
			deque<pi> dk;
			auto add = [&] (int x, int y) {
				while(SZ(dk) && dk.back().F <= x) dk.pop_back();
				dk.EB(x, y);
			};
			for(int k = 0, kk = 0; k < SZ(pos); k++) {
				while(kk < SZ(pos) && kk <= k + rb) {
					add(dp[pos[kk]] - kk, kk);
					kk++;
				}
				while(dk[0].S < k + lb)
					dk.pop_front();
				ndp[pos[k]] = dk[0].F + k;
			}
		};
		if(i > 0) {
			for(int j = 0; j < i; j++) {
				vi pos;
				for(int k = j; k < 2 * C; k += i)
					pos.PB(k);
				go(pos);
			}
		} else {
			for(int j = 0; j < -i; j++) {
				vi pos;
				for(int k = j; k < 2 * C; k -= i)
					pos.PB(k);
				reverse(ALL(pos));
				go(pos);	
			}
		}
		swap(dp, ndp);
	}
	if(dp[l - tot + C] < -1e8) cout << "impossible\n";
	else cout << ans + dp[l - tot + C] << '\n';


}

# Verdict Execution time Memory Grader output
1 Correct 32 ms 6668 KB Output is correct
2 Correct 43 ms 6708 KB Output is correct
3 Correct 18 ms 6628 KB Output is correct
4 Correct 160 ms 6680 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 701 ms 6628 KB Output is correct
7 Correct 691 ms 6692 KB Output is correct
8 Correct 683 ms 6632 KB Output is correct
9 Correct 664 ms 6612 KB Output is correct
10 Correct 682 ms 6752 KB Output is correct
11 Correct 705 ms 6760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 6668 KB Output is correct
2 Correct 43 ms 6708 KB Output is correct
3 Correct 18 ms 6628 KB Output is correct
4 Correct 160 ms 6680 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 701 ms 6628 KB Output is correct
7 Correct 691 ms 6692 KB Output is correct
8 Correct 683 ms 6632 KB Output is correct
9 Correct 664 ms 6612 KB Output is correct
10 Correct 682 ms 6752 KB Output is correct
11 Correct 705 ms 6760 KB Output is correct
12 Correct 34 ms 6656 KB Output is correct
13 Correct 46 ms 6692 KB Output is correct
14 Correct 19 ms 6628 KB Output is correct
15 Correct 132 ms 6592 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 693 ms 6620 KB Output is correct
18 Correct 670 ms 6804 KB Output is correct
19 Correct 721 ms 6628 KB Output is correct
20 Correct 697 ms 6656 KB Output is correct
21 Correct 675 ms 6832 KB Output is correct
22 Correct 691 ms 6688 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1408 ms 6676 KB Output is correct
25 Correct 1343 ms 6616 KB Output is correct
26 Correct 1373 ms 6620 KB Output is correct
27 Correct 1404 ms 6672 KB Output is correct
28 Correct 1354 ms 6716 KB Output is correct
29 Correct 1367 ms 6596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 6596 KB Output is correct
2 Correct 414 ms 6704 KB Output is correct
3 Correct 403 ms 6660 KB Output is correct
4 Correct 407 ms 6692 KB Output is correct
5 Correct 402 ms 6692 KB Output is correct
6 Correct 398 ms 7584 KB Output is correct
7 Correct 385 ms 6720 KB Output is correct
8 Correct 408 ms 6704 KB Output is correct
9 Correct 412 ms 7616 KB Output is correct
10 Correct 400 ms 6688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 6596 KB Output is correct
2 Correct 414 ms 6704 KB Output is correct
3 Correct 403 ms 6660 KB Output is correct
4 Correct 407 ms 6692 KB Output is correct
5 Correct 402 ms 6692 KB Output is correct
6 Correct 398 ms 7584 KB Output is correct
7 Correct 385 ms 6720 KB Output is correct
8 Correct 408 ms 6704 KB Output is correct
9 Correct 412 ms 7616 KB Output is correct
10 Correct 400 ms 6688 KB Output is correct
11 Correct 32 ms 6668 KB Output is correct
12 Correct 41 ms 6700 KB Output is correct
13 Correct 19 ms 6652 KB Output is correct
14 Correct 134 ms 6664 KB Output is correct
15 Correct 399 ms 6712 KB Output is correct
16 Correct 425 ms 6616 KB Output is correct
17 Correct 439 ms 6640 KB Output is correct
18 Correct 440 ms 6628 KB Output is correct
19 Correct 436 ms 7580 KB Output is correct
20 Correct 431 ms 6756 KB Output is correct
21 Correct 431 ms 6832 KB Output is correct
22 Correct 432 ms 7476 KB Output is correct
23 Correct 455 ms 6640 KB Output is correct
24 Correct 455 ms 6696 KB Output is correct
25 Correct 453 ms 6668 KB Output is correct
26 Correct 425 ms 6636 KB Output is correct
27 Correct 432 ms 6696 KB Output is correct
28 Correct 433 ms 7668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 6596 KB Output is correct
2 Correct 414 ms 6704 KB Output is correct
3 Correct 403 ms 6660 KB Output is correct
4 Correct 407 ms 6692 KB Output is correct
5 Correct 402 ms 6692 KB Output is correct
6 Correct 398 ms 7584 KB Output is correct
7 Correct 385 ms 6720 KB Output is correct
8 Correct 408 ms 6704 KB Output is correct
9 Correct 412 ms 7616 KB Output is correct
10 Correct 400 ms 6688 KB Output is correct
11 Correct 143 ms 6676 KB Output is correct
12 Correct 449 ms 6676 KB Output is correct
13 Correct 415 ms 6688 KB Output is correct
14 Correct 465 ms 6656 KB Output is correct
15 Correct 474 ms 6616 KB Output is correct
16 Correct 536 ms 7584 KB Output is correct
17 Correct 480 ms 6672 KB Output is correct
18 Correct 415 ms 6676 KB Output is correct
19 Correct 410 ms 7696 KB Output is correct
20 Correct 454 ms 6640 KB Output is correct
21 Correct 743 ms 6672 KB Output is correct
22 Correct 762 ms 6644 KB Output is correct
23 Correct 710 ms 6656 KB Output is correct
24 Correct 866 ms 6800 KB Output is correct
25 Correct 803 ms 7584 KB Output is correct
26 Correct 691 ms 6640 KB Output is correct
27 Correct 723 ms 7584 KB Output is correct
28 Correct 717 ms 6644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 6668 KB Output is correct
2 Correct 43 ms 6708 KB Output is correct
3 Correct 18 ms 6628 KB Output is correct
4 Correct 160 ms 6680 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 701 ms 6628 KB Output is correct
7 Correct 691 ms 6692 KB Output is correct
8 Correct 683 ms 6632 KB Output is correct
9 Correct 664 ms 6612 KB Output is correct
10 Correct 682 ms 6752 KB Output is correct
11 Correct 705 ms 6760 KB Output is correct
12 Correct 131 ms 6596 KB Output is correct
13 Correct 414 ms 6704 KB Output is correct
14 Correct 403 ms 6660 KB Output is correct
15 Correct 407 ms 6692 KB Output is correct
16 Correct 402 ms 6692 KB Output is correct
17 Correct 398 ms 7584 KB Output is correct
18 Correct 385 ms 6720 KB Output is correct
19 Correct 408 ms 6704 KB Output is correct
20 Correct 412 ms 7616 KB Output is correct
21 Correct 400 ms 6688 KB Output is correct
22 Correct 32 ms 6668 KB Output is correct
23 Correct 41 ms 6700 KB Output is correct
24 Correct 19 ms 6652 KB Output is correct
25 Correct 134 ms 6664 KB Output is correct
26 Correct 399 ms 6712 KB Output is correct
27 Correct 425 ms 6616 KB Output is correct
28 Correct 439 ms 6640 KB Output is correct
29 Correct 440 ms 6628 KB Output is correct
30 Correct 436 ms 7580 KB Output is correct
31 Correct 431 ms 6756 KB Output is correct
32 Correct 431 ms 6832 KB Output is correct
33 Correct 432 ms 7476 KB Output is correct
34 Correct 455 ms 6640 KB Output is correct
35 Correct 455 ms 6696 KB Output is correct
36 Correct 453 ms 6668 KB Output is correct
37 Correct 425 ms 6636 KB Output is correct
38 Correct 432 ms 6696 KB Output is correct
39 Correct 433 ms 7668 KB Output is correct
40 Correct 143 ms 6676 KB Output is correct
41 Correct 449 ms 6676 KB Output is correct
42 Correct 415 ms 6688 KB Output is correct
43 Correct 465 ms 6656 KB Output is correct
44 Correct 474 ms 6616 KB Output is correct
45 Correct 536 ms 7584 KB Output is correct
46 Correct 480 ms 6672 KB Output is correct
47 Correct 415 ms 6676 KB Output is correct
48 Correct 410 ms 7696 KB Output is correct
49 Correct 454 ms 6640 KB Output is correct
50 Correct 743 ms 6672 KB Output is correct
51 Correct 762 ms 6644 KB Output is correct
52 Correct 710 ms 6656 KB Output is correct
53 Correct 866 ms 6800 KB Output is correct
54 Correct 803 ms 7584 KB Output is correct
55 Correct 691 ms 6640 KB Output is correct
56 Correct 723 ms 7584 KB Output is correct
57 Correct 717 ms 6644 KB Output is correct
58 Correct 33 ms 6728 KB Output is correct
59 Correct 47 ms 6692 KB Output is correct
60 Correct 25 ms 6692 KB Output is correct
61 Correct 147 ms 6640 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 754 ms 6724 KB Output is correct
64 Correct 715 ms 6660 KB Output is correct
65 Correct 768 ms 6644 KB Output is correct
66 Correct 733 ms 6636 KB Output is correct
67 Correct 896 ms 6644 KB Output is correct
68 Correct 714 ms 6672 KB Output is correct
69 Correct 414 ms 6712 KB Output is correct
70 Correct 425 ms 6656 KB Output is correct
71 Correct 451 ms 6664 KB Output is correct
72 Correct 415 ms 6640 KB Output is correct
73 Correct 431 ms 7584 KB Output is correct
74 Correct 403 ms 6692 KB Output is correct
75 Correct 466 ms 6688 KB Output is correct
76 Correct 443 ms 7584 KB Output is correct
77 Correct 427 ms 6700 KB Output is correct
78 Correct 444 ms 6656 KB Output is correct
79 Correct 462 ms 6688 KB Output is correct
80 Correct 601 ms 6680 KB Output is correct
81 Correct 477 ms 6724 KB Output is correct
82 Correct 446 ms 7576 KB Output is correct
83 Correct 719 ms 6736 KB Output is correct
84 Correct 730 ms 6648 KB Output is correct
85 Correct 717 ms 7580 KB Output is correct
86 Correct 694 ms 6644 KB Output is correct
87 Correct 695 ms 7616 KB Output is correct
88 Correct 733 ms 6608 KB Output is correct
89 Correct 776 ms 6768 KB Output is correct
90 Correct 764 ms 9056 KB Output is correct
91 Correct 721 ms 7576 KB Output is correct
92 Correct 890 ms 8944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 6596 KB Output is correct
2 Correct 414 ms 6704 KB Output is correct
3 Correct 403 ms 6660 KB Output is correct
4 Correct 407 ms 6692 KB Output is correct
5 Correct 402 ms 6692 KB Output is correct
6 Correct 398 ms 7584 KB Output is correct
7 Correct 385 ms 6720 KB Output is correct
8 Correct 408 ms 6704 KB Output is correct
9 Correct 412 ms 7616 KB Output is correct
10 Correct 400 ms 6688 KB Output is correct
11 Correct 143 ms 6676 KB Output is correct
12 Correct 449 ms 6676 KB Output is correct
13 Correct 415 ms 6688 KB Output is correct
14 Correct 465 ms 6656 KB Output is correct
15 Correct 474 ms 6616 KB Output is correct
16 Correct 536 ms 7584 KB Output is correct
17 Correct 480 ms 6672 KB Output is correct
18 Correct 415 ms 6676 KB Output is correct
19 Correct 410 ms 7696 KB Output is correct
20 Correct 454 ms 6640 KB Output is correct
21 Correct 743 ms 6672 KB Output is correct
22 Correct 762 ms 6644 KB Output is correct
23 Correct 710 ms 6656 KB Output is correct
24 Correct 866 ms 6800 KB Output is correct
25 Correct 803 ms 7584 KB Output is correct
26 Correct 691 ms 6640 KB Output is correct
27 Correct 723 ms 7584 KB Output is correct
28 Correct 717 ms 6644 KB Output is correct
29 Correct 227 ms 6696 KB Output is correct
30 Correct 461 ms 6684 KB Output is correct
31 Correct 432 ms 6632 KB Output is correct
32 Correct 468 ms 6776 KB Output is correct
33 Correct 433 ms 6704 KB Output is correct
34 Correct 462 ms 7584 KB Output is correct
35 Correct 530 ms 6684 KB Output is correct
36 Correct 415 ms 6832 KB Output is correct
37 Correct 476 ms 7584 KB Output is correct
38 Correct 421 ms 6632 KB Output is correct
39 Correct 709 ms 6632 KB Output is correct
40 Correct 793 ms 6676 KB Output is correct
41 Correct 806 ms 6708 KB Output is correct
42 Correct 721 ms 6736 KB Output is correct
43 Correct 761 ms 7584 KB Output is correct
44 Correct 725 ms 6608 KB Output is correct
45 Correct 725 ms 7584 KB Output is correct
46 Correct 750 ms 6660 KB Output is correct
47 Correct 1472 ms 6592 KB Output is correct
48 Correct 1501 ms 6612 KB Output is correct
49 Correct 1513 ms 7584 KB Output is correct
50 Correct 1422 ms 6696 KB Output is correct
51 Correct 1461 ms 7596 KB Output is correct
52 Correct 1432 ms 6728 KB Output is correct
53 Correct 1429 ms 7580 KB Output is correct
54 Correct 1401 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 6668 KB Output is correct
2 Correct 43 ms 6708 KB Output is correct
3 Correct 18 ms 6628 KB Output is correct
4 Correct 160 ms 6680 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 701 ms 6628 KB Output is correct
7 Correct 691 ms 6692 KB Output is correct
8 Correct 683 ms 6632 KB Output is correct
9 Correct 664 ms 6612 KB Output is correct
10 Correct 682 ms 6752 KB Output is correct
11 Correct 705 ms 6760 KB Output is correct
12 Correct 34 ms 6656 KB Output is correct
13 Correct 46 ms 6692 KB Output is correct
14 Correct 19 ms 6628 KB Output is correct
15 Correct 132 ms 6592 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 693 ms 6620 KB Output is correct
18 Correct 670 ms 6804 KB Output is correct
19 Correct 721 ms 6628 KB Output is correct
20 Correct 697 ms 6656 KB Output is correct
21 Correct 675 ms 6832 KB Output is correct
22 Correct 691 ms 6688 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1408 ms 6676 KB Output is correct
25 Correct 1343 ms 6616 KB Output is correct
26 Correct 1373 ms 6620 KB Output is correct
27 Correct 1404 ms 6672 KB Output is correct
28 Correct 1354 ms 6716 KB Output is correct
29 Correct 1367 ms 6596 KB Output is correct
30 Correct 131 ms 6596 KB Output is correct
31 Correct 414 ms 6704 KB Output is correct
32 Correct 403 ms 6660 KB Output is correct
33 Correct 407 ms 6692 KB Output is correct
34 Correct 402 ms 6692 KB Output is correct
35 Correct 398 ms 7584 KB Output is correct
36 Correct 385 ms 6720 KB Output is correct
37 Correct 408 ms 6704 KB Output is correct
38 Correct 412 ms 7616 KB Output is correct
39 Correct 400 ms 6688 KB Output is correct
40 Correct 32 ms 6668 KB Output is correct
41 Correct 41 ms 6700 KB Output is correct
42 Correct 19 ms 6652 KB Output is correct
43 Correct 134 ms 6664 KB Output is correct
44 Correct 399 ms 6712 KB Output is correct
45 Correct 425 ms 6616 KB Output is correct
46 Correct 439 ms 6640 KB Output is correct
47 Correct 440 ms 6628 KB Output is correct
48 Correct 436 ms 7580 KB Output is correct
49 Correct 431 ms 6756 KB Output is correct
50 Correct 431 ms 6832 KB Output is correct
51 Correct 432 ms 7476 KB Output is correct
52 Correct 455 ms 6640 KB Output is correct
53 Correct 455 ms 6696 KB Output is correct
54 Correct 453 ms 6668 KB Output is correct
55 Correct 425 ms 6636 KB Output is correct
56 Correct 432 ms 6696 KB Output is correct
57 Correct 433 ms 7668 KB Output is correct
58 Correct 143 ms 6676 KB Output is correct
59 Correct 449 ms 6676 KB Output is correct
60 Correct 415 ms 6688 KB Output is correct
61 Correct 465 ms 6656 KB Output is correct
62 Correct 474 ms 6616 KB Output is correct
63 Correct 536 ms 7584 KB Output is correct
64 Correct 480 ms 6672 KB Output is correct
65 Correct 415 ms 6676 KB Output is correct
66 Correct 410 ms 7696 KB Output is correct
67 Correct 454 ms 6640 KB Output is correct
68 Correct 743 ms 6672 KB Output is correct
69 Correct 762 ms 6644 KB Output is correct
70 Correct 710 ms 6656 KB Output is correct
71 Correct 866 ms 6800 KB Output is correct
72 Correct 803 ms 7584 KB Output is correct
73 Correct 691 ms 6640 KB Output is correct
74 Correct 723 ms 7584 KB Output is correct
75 Correct 717 ms 6644 KB Output is correct
76 Correct 33 ms 6728 KB Output is correct
77 Correct 47 ms 6692 KB Output is correct
78 Correct 25 ms 6692 KB Output is correct
79 Correct 147 ms 6640 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 754 ms 6724 KB Output is correct
82 Correct 715 ms 6660 KB Output is correct
83 Correct 768 ms 6644 KB Output is correct
84 Correct 733 ms 6636 KB Output is correct
85 Correct 896 ms 6644 KB Output is correct
86 Correct 714 ms 6672 KB Output is correct
87 Correct 414 ms 6712 KB Output is correct
88 Correct 425 ms 6656 KB Output is correct
89 Correct 451 ms 6664 KB Output is correct
90 Correct 415 ms 6640 KB Output is correct
91 Correct 431 ms 7584 KB Output is correct
92 Correct 403 ms 6692 KB Output is correct
93 Correct 466 ms 6688 KB Output is correct
94 Correct 443 ms 7584 KB Output is correct
95 Correct 427 ms 6700 KB Output is correct
96 Correct 444 ms 6656 KB Output is correct
97 Correct 462 ms 6688 KB Output is correct
98 Correct 601 ms 6680 KB Output is correct
99 Correct 477 ms 6724 KB Output is correct
100 Correct 446 ms 7576 KB Output is correct
101 Correct 719 ms 6736 KB Output is correct
102 Correct 730 ms 6648 KB Output is correct
103 Correct 717 ms 7580 KB Output is correct
104 Correct 694 ms 6644 KB Output is correct
105 Correct 695 ms 7616 KB Output is correct
106 Correct 733 ms 6608 KB Output is correct
107 Correct 776 ms 6768 KB Output is correct
108 Correct 764 ms 9056 KB Output is correct
109 Correct 721 ms 7576 KB Output is correct
110 Correct 890 ms 8944 KB Output is correct
111 Correct 227 ms 6696 KB Output is correct
112 Correct 461 ms 6684 KB Output is correct
113 Correct 432 ms 6632 KB Output is correct
114 Correct 468 ms 6776 KB Output is correct
115 Correct 433 ms 6704 KB Output is correct
116 Correct 462 ms 7584 KB Output is correct
117 Correct 530 ms 6684 KB Output is correct
118 Correct 415 ms 6832 KB Output is correct
119 Correct 476 ms 7584 KB Output is correct
120 Correct 421 ms 6632 KB Output is correct
121 Correct 709 ms 6632 KB Output is correct
122 Correct 793 ms 6676 KB Output is correct
123 Correct 806 ms 6708 KB Output is correct
124 Correct 721 ms 6736 KB Output is correct
125 Correct 761 ms 7584 KB Output is correct
126 Correct 725 ms 6608 KB Output is correct
127 Correct 725 ms 7584 KB Output is correct
128 Correct 750 ms 6660 KB Output is correct
129 Correct 1472 ms 6592 KB Output is correct
130 Correct 1501 ms 6612 KB Output is correct
131 Correct 1513 ms 7584 KB Output is correct
132 Correct 1422 ms 6696 KB Output is correct
133 Correct 1461 ms 7596 KB Output is correct
134 Correct 1432 ms 6728 KB Output is correct
135 Correct 1429 ms 7580 KB Output is correct
136 Correct 1401 ms 6744 KB Output is correct
137 Correct 34 ms 6652 KB Output is correct
138 Correct 46 ms 6692 KB Output is correct
139 Correct 19 ms 6660 KB Output is correct
140 Correct 131 ms 6672 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 698 ms 6612 KB Output is correct
143 Correct 716 ms 6640 KB Output is correct
144 Correct 692 ms 6728 KB Output is correct
145 Correct 687 ms 6640 KB Output is correct
146 Correct 704 ms 6692 KB Output is correct
147 Correct 801 ms 6644 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 1404 ms 6668 KB Output is correct
150 Correct 1373 ms 6740 KB Output is correct
151 Correct 1438 ms 6612 KB Output is correct
152 Correct 1452 ms 6732 KB Output is correct
153 Correct 1349 ms 6820 KB Output is correct
154 Correct 1446 ms 6728 KB Output is correct
155 Correct 501 ms 6708 KB Output is correct
156 Correct 437 ms 6680 KB Output is correct
157 Correct 410 ms 6776 KB Output is correct
158 Correct 412 ms 6692 KB Output is correct
159 Correct 397 ms 7500 KB Output is correct
160 Correct 421 ms 6780 KB Output is correct
161 Correct 412 ms 6616 KB Output is correct
162 Correct 420 ms 7672 KB Output is correct
163 Correct 624 ms 6748 KB Output is correct
164 Correct 691 ms 6672 KB Output is correct
165 Correct 698 ms 6668 KB Output is correct
166 Correct 729 ms 7680 KB Output is correct
167 Correct 742 ms 6672 KB Output is correct
168 Correct 683 ms 7584 KB Output is correct
169 Correct 695 ms 6676 KB Output is correct
170 Correct 477 ms 6708 KB Output is correct
171 Correct 455 ms 6708 KB Output is correct
172 Correct 428 ms 6728 KB Output is correct
173 Correct 446 ms 6632 KB Output is correct
174 Correct 442 ms 7576 KB Output is correct
175 Correct 708 ms 6864 KB Output is correct
176 Correct 705 ms 9172 KB Output is correct
177 Correct 761 ms 7588 KB Output is correct
178 Correct 703 ms 9108 KB Output is correct
179 Correct 1375 ms 7700 KB Output is correct
180 Correct 1393 ms 6800 KB Output is correct
181 Correct 1404 ms 7556 KB Output is correct
182 Correct 1386 ms 6676 KB Output is correct
183 Correct 1488 ms 7492 KB Output is correct
184 Correct 1392 ms 6660 KB Output is correct
185 Correct 1424 ms 6760 KB Output is correct
186 Correct 1474 ms 6716 KB Output is correct
187 Correct 1434 ms 6708 KB Output is correct
188 Correct 1453 ms 7576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 6596 KB Output is correct
2 Correct 414 ms 6704 KB Output is correct
3 Correct 403 ms 6660 KB Output is correct
4 Correct 407 ms 6692 KB Output is correct
5 Correct 402 ms 6692 KB Output is correct
6 Correct 398 ms 7584 KB Output is correct
7 Correct 385 ms 6720 KB Output is correct
8 Correct 408 ms 6704 KB Output is correct
9 Correct 412 ms 7616 KB Output is correct
10 Correct 400 ms 6688 KB Output is correct
11 Correct 143 ms 6676 KB Output is correct
12 Correct 449 ms 6676 KB Output is correct
13 Correct 415 ms 6688 KB Output is correct
14 Correct 465 ms 6656 KB Output is correct
15 Correct 474 ms 6616 KB Output is correct
16 Correct 536 ms 7584 KB Output is correct
17 Correct 480 ms 6672 KB Output is correct
18 Correct 415 ms 6676 KB Output is correct
19 Correct 410 ms 7696 KB Output is correct
20 Correct 454 ms 6640 KB Output is correct
21 Correct 743 ms 6672 KB Output is correct
22 Correct 762 ms 6644 KB Output is correct
23 Correct 710 ms 6656 KB Output is correct
24 Correct 866 ms 6800 KB Output is correct
25 Correct 803 ms 7584 KB Output is correct
26 Correct 691 ms 6640 KB Output is correct
27 Correct 723 ms 7584 KB Output is correct
28 Correct 717 ms 6644 KB Output is correct
29 Correct 227 ms 6696 KB Output is correct
30 Correct 461 ms 6684 KB Output is correct
31 Correct 432 ms 6632 KB Output is correct
32 Correct 468 ms 6776 KB Output is correct
33 Correct 433 ms 6704 KB Output is correct
34 Correct 462 ms 7584 KB Output is correct
35 Correct 530 ms 6684 KB Output is correct
36 Correct 415 ms 6832 KB Output is correct
37 Correct 476 ms 7584 KB Output is correct
38 Correct 421 ms 6632 KB Output is correct
39 Correct 709 ms 6632 KB Output is correct
40 Correct 793 ms 6676 KB Output is correct
41 Correct 806 ms 6708 KB Output is correct
42 Correct 721 ms 6736 KB Output is correct
43 Correct 761 ms 7584 KB Output is correct
44 Correct 725 ms 6608 KB Output is correct
45 Correct 725 ms 7584 KB Output is correct
46 Correct 750 ms 6660 KB Output is correct
47 Correct 1472 ms 6592 KB Output is correct
48 Correct 1501 ms 6612 KB Output is correct
49 Correct 1513 ms 7584 KB Output is correct
50 Correct 1422 ms 6696 KB Output is correct
51 Correct 1461 ms 7596 KB Output is correct
52 Correct 1432 ms 6728 KB Output is correct
53 Correct 1429 ms 7580 KB Output is correct
54 Correct 1401 ms 6744 KB Output is correct
55 Correct 139 ms 6664 KB Output is correct
56 Correct 427 ms 6700 KB Output is correct
57 Correct 422 ms 6636 KB Output is correct
58 Correct 398 ms 6692 KB Output is correct
59 Correct 421 ms 6680 KB Output is correct
60 Correct 403 ms 7580 KB Output is correct
61 Correct 420 ms 6680 KB Output is correct
62 Correct 442 ms 6668 KB Output is correct
63 Correct 439 ms 7536 KB Output is correct
64 Correct 421 ms 6708 KB Output is correct
65 Correct 679 ms 6704 KB Output is correct
66 Correct 712 ms 6760 KB Output is correct
67 Correct 687 ms 6672 KB Output is correct
68 Correct 645 ms 6792 KB Output is correct
69 Correct 661 ms 7720 KB Output is correct
70 Correct 646 ms 6624 KB Output is correct
71 Correct 693 ms 7620 KB Output is correct
72 Correct 658 ms 6780 KB Output is correct
73 Correct 1362 ms 6620 KB Output is correct
74 Correct 1277 ms 6660 KB Output is correct
75 Correct 1306 ms 7580 KB Output is correct
76 Correct 1288 ms 6656 KB Output is correct
77 Correct 1312 ms 7672 KB Output is correct
78 Correct 1288 ms 6844 KB Output is correct
79 Correct 1279 ms 7528 KB Output is correct
80 Correct 1312 ms 6612 KB Output is correct
81 Correct 3903 ms 6828 KB Output is correct
82 Correct 3831 ms 6796 KB Output is correct
83 Correct 3888 ms 6808 KB Output is correct
84 Correct 3855 ms 7588 KB Output is correct
85 Correct 3838 ms 6672 KB Output is correct
86 Correct 3898 ms 6676 KB Output is correct
87 Correct 3881 ms 6668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 6668 KB Output is correct
2 Correct 43 ms 6708 KB Output is correct
3 Correct 18 ms 6628 KB Output is correct
4 Correct 160 ms 6680 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 701 ms 6628 KB Output is correct
7 Correct 691 ms 6692 KB Output is correct
8 Correct 683 ms 6632 KB Output is correct
9 Correct 664 ms 6612 KB Output is correct
10 Correct 682 ms 6752 KB Output is correct
11 Correct 705 ms 6760 KB Output is correct
12 Correct 34 ms 6656 KB Output is correct
13 Correct 46 ms 6692 KB Output is correct
14 Correct 19 ms 6628 KB Output is correct
15 Correct 132 ms 6592 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 693 ms 6620 KB Output is correct
18 Correct 670 ms 6804 KB Output is correct
19 Correct 721 ms 6628 KB Output is correct
20 Correct 697 ms 6656 KB Output is correct
21 Correct 675 ms 6832 KB Output is correct
22 Correct 691 ms 6688 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1408 ms 6676 KB Output is correct
25 Correct 1343 ms 6616 KB Output is correct
26 Correct 1373 ms 6620 KB Output is correct
27 Correct 1404 ms 6672 KB Output is correct
28 Correct 1354 ms 6716 KB Output is correct
29 Correct 1367 ms 6596 KB Output is correct
30 Correct 131 ms 6596 KB Output is correct
31 Correct 414 ms 6704 KB Output is correct
32 Correct 403 ms 6660 KB Output is correct
33 Correct 407 ms 6692 KB Output is correct
34 Correct 402 ms 6692 KB Output is correct
35 Correct 398 ms 7584 KB Output is correct
36 Correct 385 ms 6720 KB Output is correct
37 Correct 408 ms 6704 KB Output is correct
38 Correct 412 ms 7616 KB Output is correct
39 Correct 400 ms 6688 KB Output is correct
40 Correct 32 ms 6668 KB Output is correct
41 Correct 41 ms 6700 KB Output is correct
42 Correct 19 ms 6652 KB Output is correct
43 Correct 134 ms 6664 KB Output is correct
44 Correct 399 ms 6712 KB Output is correct
45 Correct 425 ms 6616 KB Output is correct
46 Correct 439 ms 6640 KB Output is correct
47 Correct 440 ms 6628 KB Output is correct
48 Correct 436 ms 7580 KB Output is correct
49 Correct 431 ms 6756 KB Output is correct
50 Correct 431 ms 6832 KB Output is correct
51 Correct 432 ms 7476 KB Output is correct
52 Correct 455 ms 6640 KB Output is correct
53 Correct 455 ms 6696 KB Output is correct
54 Correct 453 ms 6668 KB Output is correct
55 Correct 425 ms 6636 KB Output is correct
56 Correct 432 ms 6696 KB Output is correct
57 Correct 433 ms 7668 KB Output is correct
58 Correct 143 ms 6676 KB Output is correct
59 Correct 449 ms 6676 KB Output is correct
60 Correct 415 ms 6688 KB Output is correct
61 Correct 465 ms 6656 KB Output is correct
62 Correct 474 ms 6616 KB Output is correct
63 Correct 536 ms 7584 KB Output is correct
64 Correct 480 ms 6672 KB Output is correct
65 Correct 415 ms 6676 KB Output is correct
66 Correct 410 ms 7696 KB Output is correct
67 Correct 454 ms 6640 KB Output is correct
68 Correct 743 ms 6672 KB Output is correct
69 Correct 762 ms 6644 KB Output is correct
70 Correct 710 ms 6656 KB Output is correct
71 Correct 866 ms 6800 KB Output is correct
72 Correct 803 ms 7584 KB Output is correct
73 Correct 691 ms 6640 KB Output is correct
74 Correct 723 ms 7584 KB Output is correct
75 Correct 717 ms 6644 KB Output is correct
76 Correct 33 ms 6728 KB Output is correct
77 Correct 47 ms 6692 KB Output is correct
78 Correct 25 ms 6692 KB Output is correct
79 Correct 147 ms 6640 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 754 ms 6724 KB Output is correct
82 Correct 715 ms 6660 KB Output is correct
83 Correct 768 ms 6644 KB Output is correct
84 Correct 733 ms 6636 KB Output is correct
85 Correct 896 ms 6644 KB Output is correct
86 Correct 714 ms 6672 KB Output is correct
87 Correct 414 ms 6712 KB Output is correct
88 Correct 425 ms 6656 KB Output is correct
89 Correct 451 ms 6664 KB Output is correct
90 Correct 415 ms 6640 KB Output is correct
91 Correct 431 ms 7584 KB Output is correct
92 Correct 403 ms 6692 KB Output is correct
93 Correct 466 ms 6688 KB Output is correct
94 Correct 443 ms 7584 KB Output is correct
95 Correct 427 ms 6700 KB Output is correct
96 Correct 444 ms 6656 KB Output is correct
97 Correct 462 ms 6688 KB Output is correct
98 Correct 601 ms 6680 KB Output is correct
99 Correct 477 ms 6724 KB Output is correct
100 Correct 446 ms 7576 KB Output is correct
101 Correct 719 ms 6736 KB Output is correct
102 Correct 730 ms 6648 KB Output is correct
103 Correct 717 ms 7580 KB Output is correct
104 Correct 694 ms 6644 KB Output is correct
105 Correct 695 ms 7616 KB Output is correct
106 Correct 733 ms 6608 KB Output is correct
107 Correct 776 ms 6768 KB Output is correct
108 Correct 764 ms 9056 KB Output is correct
109 Correct 721 ms 7576 KB Output is correct
110 Correct 890 ms 8944 KB Output is correct
111 Correct 227 ms 6696 KB Output is correct
112 Correct 461 ms 6684 KB Output is correct
113 Correct 432 ms 6632 KB Output is correct
114 Correct 468 ms 6776 KB Output is correct
115 Correct 433 ms 6704 KB Output is correct
116 Correct 462 ms 7584 KB Output is correct
117 Correct 530 ms 6684 KB Output is correct
118 Correct 415 ms 6832 KB Output is correct
119 Correct 476 ms 7584 KB Output is correct
120 Correct 421 ms 6632 KB Output is correct
121 Correct 709 ms 6632 KB Output is correct
122 Correct 793 ms 6676 KB Output is correct
123 Correct 806 ms 6708 KB Output is correct
124 Correct 721 ms 6736 KB Output is correct
125 Correct 761 ms 7584 KB Output is correct
126 Correct 725 ms 6608 KB Output is correct
127 Correct 725 ms 7584 KB Output is correct
128 Correct 750 ms 6660 KB Output is correct
129 Correct 1472 ms 6592 KB Output is correct
130 Correct 1501 ms 6612 KB Output is correct
131 Correct 1513 ms 7584 KB Output is correct
132 Correct 1422 ms 6696 KB Output is correct
133 Correct 1461 ms 7596 KB Output is correct
134 Correct 1432 ms 6728 KB Output is correct
135 Correct 1429 ms 7580 KB Output is correct
136 Correct 1401 ms 6744 KB Output is correct
137 Correct 34 ms 6652 KB Output is correct
138 Correct 46 ms 6692 KB Output is correct
139 Correct 19 ms 6660 KB Output is correct
140 Correct 131 ms 6672 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 698 ms 6612 KB Output is correct
143 Correct 716 ms 6640 KB Output is correct
144 Correct 692 ms 6728 KB Output is correct
145 Correct 687 ms 6640 KB Output is correct
146 Correct 704 ms 6692 KB Output is correct
147 Correct 801 ms 6644 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 1404 ms 6668 KB Output is correct
150 Correct 1373 ms 6740 KB Output is correct
151 Correct 1438 ms 6612 KB Output is correct
152 Correct 1452 ms 6732 KB Output is correct
153 Correct 1349 ms 6820 KB Output is correct
154 Correct 1446 ms 6728 KB Output is correct
155 Correct 501 ms 6708 KB Output is correct
156 Correct 437 ms 6680 KB Output is correct
157 Correct 410 ms 6776 KB Output is correct
158 Correct 412 ms 6692 KB Output is correct
159 Correct 397 ms 7500 KB Output is correct
160 Correct 421 ms 6780 KB Output is correct
161 Correct 412 ms 6616 KB Output is correct
162 Correct 420 ms 7672 KB Output is correct
163 Correct 624 ms 6748 KB Output is correct
164 Correct 691 ms 6672 KB Output is correct
165 Correct 698 ms 6668 KB Output is correct
166 Correct 729 ms 7680 KB Output is correct
167 Correct 742 ms 6672 KB Output is correct
168 Correct 683 ms 7584 KB Output is correct
169 Correct 695 ms 6676 KB Output is correct
170 Correct 477 ms 6708 KB Output is correct
171 Correct 455 ms 6708 KB Output is correct
172 Correct 428 ms 6728 KB Output is correct
173 Correct 446 ms 6632 KB Output is correct
174 Correct 442 ms 7576 KB Output is correct
175 Correct 708 ms 6864 KB Output is correct
176 Correct 705 ms 9172 KB Output is correct
177 Correct 761 ms 7588 KB Output is correct
178 Correct 703 ms 9108 KB Output is correct
179 Correct 1375 ms 7700 KB Output is correct
180 Correct 1393 ms 6800 KB Output is correct
181 Correct 1404 ms 7556 KB Output is correct
182 Correct 1386 ms 6676 KB Output is correct
183 Correct 1488 ms 7492 KB Output is correct
184 Correct 1392 ms 6660 KB Output is correct
185 Correct 1424 ms 6760 KB Output is correct
186 Correct 1474 ms 6716 KB Output is correct
187 Correct 1434 ms 6708 KB Output is correct
188 Correct 1453 ms 7576 KB Output is correct
189 Correct 139 ms 6664 KB Output is correct
190 Correct 427 ms 6700 KB Output is correct
191 Correct 422 ms 6636 KB Output is correct
192 Correct 398 ms 6692 KB Output is correct
193 Correct 421 ms 6680 KB Output is correct
194 Correct 403 ms 7580 KB Output is correct
195 Correct 420 ms 6680 KB Output is correct
196 Correct 442 ms 6668 KB Output is correct
197 Correct 439 ms 7536 KB Output is correct
198 Correct 421 ms 6708 KB Output is correct
199 Correct 679 ms 6704 KB Output is correct
200 Correct 712 ms 6760 KB Output is correct
201 Correct 687 ms 6672 KB Output is correct
202 Correct 645 ms 6792 KB Output is correct
203 Correct 661 ms 7720 KB Output is correct
204 Correct 646 ms 6624 KB Output is correct
205 Correct 693 ms 7620 KB Output is correct
206 Correct 658 ms 6780 KB Output is correct
207 Correct 1362 ms 6620 KB Output is correct
208 Correct 1277 ms 6660 KB Output is correct
209 Correct 1306 ms 7580 KB Output is correct
210 Correct 1288 ms 6656 KB Output is correct
211 Correct 1312 ms 7672 KB Output is correct
212 Correct 1288 ms 6844 KB Output is correct
213 Correct 1279 ms 7528 KB Output is correct
214 Correct 1312 ms 6612 KB Output is correct
215 Correct 3903 ms 6828 KB Output is correct
216 Correct 3831 ms 6796 KB Output is correct
217 Correct 3888 ms 6808 KB Output is correct
218 Correct 3855 ms 7588 KB Output is correct
219 Correct 3838 ms 6672 KB Output is correct
220 Correct 3898 ms 6676 KB Output is correct
221 Correct 3881 ms 6668 KB Output is correct
222 Correct 130 ms 6608 KB Output is correct
223 Correct 389 ms 6616 KB Output is correct
224 Correct 402 ms 6708 KB Output is correct
225 Correct 381 ms 6684 KB Output is correct
226 Correct 372 ms 6736 KB Output is correct
227 Correct 383 ms 7584 KB Output is correct
228 Correct 388 ms 6684 KB Output is correct
229 Correct 378 ms 6704 KB Output is correct
230 Correct 394 ms 7632 KB Output is correct
231 Correct 380 ms 6692 KB Output is correct
232 Correct 627 ms 6732 KB Output is correct
233 Correct 643 ms 6648 KB Output is correct
234 Correct 650 ms 6644 KB Output is correct
235 Correct 669 ms 6632 KB Output is correct
236 Correct 649 ms 7752 KB Output is correct
237 Correct 641 ms 6820 KB Output is correct
238 Correct 652 ms 7656 KB Output is correct
239 Correct 638 ms 6660 KB Output is correct
240 Correct 1316 ms 6652 KB Output is correct
241 Correct 1292 ms 6888 KB Output is correct
242 Correct 1359 ms 7480 KB Output is correct
243 Correct 1285 ms 6656 KB Output is correct
244 Correct 1312 ms 7680 KB Output is correct
245 Correct 1272 ms 6800 KB Output is correct
246 Correct 1282 ms 7728 KB Output is correct
247 Correct 1353 ms 6740 KB Output is correct
248 Correct 31 ms 6668 KB Output is correct
249 Correct 45 ms 6716 KB Output is correct
250 Correct 19 ms 6664 KB Output is correct
251 Correct 0 ms 212 KB Output is correct
252 Correct 659 ms 6860 KB Output is correct
253 Correct 669 ms 6756 KB Output is correct
254 Correct 670 ms 6636 KB Output is correct
255 Correct 671 ms 6632 KB Output is correct
256 Correct 0 ms 212 KB Output is correct
257 Correct 1446 ms 6800 KB Output is correct
258 Correct 1403 ms 6608 KB Output is correct
259 Correct 1455 ms 6680 KB Output is correct
260 Correct 1486 ms 6668 KB Output is correct
261 Correct 432 ms 6680 KB Output is correct
262 Correct 425 ms 6724 KB Output is correct
263 Correct 439 ms 6676 KB Output is correct
264 Correct 433 ms 6864 KB Output is correct
265 Correct 416 ms 7584 KB Output is correct
266 Correct 753 ms 6832 KB Output is correct
267 Correct 723 ms 8992 KB Output is correct
268 Correct 730 ms 7672 KB Output is correct
269 Correct 699 ms 8980 KB Output is correct
270 Correct 1465 ms 6636 KB Output is correct
271 Correct 1477 ms 6720 KB Output is correct
272 Correct 1503 ms 6752 KB Output is correct
273 Correct 1498 ms 7580 KB Output is correct
274 Correct 4324 ms 6684 KB Output is correct
275 Correct 4097 ms 6656 KB Output is correct
276 Correct 4106 ms 6748 KB Output is correct
277 Correct 4138 ms 7584 KB Output is correct
278 Correct 4086 ms 6664 KB Output is correct
279 Correct 4118 ms 6628 KB Output is correct
280 Correct 4228 ms 6656 KB Output is correct
281 Correct 4220 ms 6628 KB Output is correct
282 Correct 4253 ms 8980 KB Output is correct
283 Correct 4372 ms 9068 KB Output is correct