답안 #569106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
569106 2022-05-26T16:51:19 Z blue Fish 2 (JOI22_fish2) C++17
100 / 100
1230 ms 37920 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
#define sz(x) int(x.size())

int N;
vll A;

int Q;

struct group
{
	int i; //inclusive of the group, not the barrier.
	ll Asum;
	int winners;
};

struct info
{
	int l;
	int r;

	ll Asum;
	int winners;

	vector<group> pref;
	vector<group> suff;

	info()
	{
		;
	}

	info(int i)
	{
		l = r = i;
		Asum = A[i];
		winners = 1;
	}
};

void combine(info& res, const info& X, const info& Y) //!
{
	// cerr << "combine called\n";
	res.l = X.l;
	res.r = Y.r;

	res.Asum = X.Asum + Y.Asum;
	res.winners = 0;







	int Xs = sz(X.suff);

	ll Xdp[1 + Xs];
	Xdp[0] = A[X.r];
	for(int i = 1; i <= Xs; i++)
		Xdp[i] = max(Xdp[i-1], A[X.suff[i-1].i - 1] - X.suff[i-1].Asum);


	int Ys = sz(Y.pref);

	ll Ydp[1 + Ys];
	Ydp[0] = A[Y.l];
	for(int i = 1; i <= Ys; i++)
		Ydp[i] = max(Ydp[i-1], A[Y.pref[i-1].i + 1] - Y.pref[i-1].Asum);


	// cerr << "#\n";




	int XYreach[1 + Xs];
	int XXreach[1 + Xs];

	int YXreach[1 + Ys];
	int YYreach[1 + Ys];

	int xi, yi;

	yi = Ys;
	for(xi = Xs; xi >= 0; xi--)
	{
		ll currsum = (xi == Xs ? X.Asum : X.suff[xi].Asum);
		while(yi >= 0 && Ydp[yi] > currsum)
			yi--;

		ll Ygain;
		if(yi == Ys)
			Ygain = Y.Asum;
		else if(yi == -1)
			Ygain = 0;
		else
			Ygain = Y.pref[yi].Asum;

		if(xi < Xs && currsum + Ygain >= A[X.suff[xi].i - 1])
		{
			XXreach[xi] = XXreach[xi+1];
			XYreach[xi] = XYreach[xi+1];
		}
		else
		{
			XXreach[xi] = xi;
			XYreach[xi] = yi;
		}
	}
	// cerr << "#2\n";


	xi = Xs;
	for(yi = Ys; yi >= 0; yi--)
	{
		ll currsum = (yi == Ys ? Y.Asum : Y.pref[yi].Asum);
		while(xi >= 0 && Xdp[xi] > currsum)
			xi--;

		ll Xgain;
		if(xi == Xs)
			Xgain = X.Asum;
		else if(xi == -1)
			Xgain = 0;
		else
			Xgain = X.suff[xi].Asum;

		if(yi < Ys && currsum + Xgain >= A[Y.pref[yi].i + 1])
		{
			YYreach[yi] = YYreach[yi+1];
			YXreach[yi] = YXreach[yi+1];
		}
		else
		{
			YYreach[yi] = yi;
			YXreach[yi] = xi;
		}
	}


	// cerr << "#3\n";






	res.pref = X.pref;


	int pi = sz(res.pref);

	if(X.Asum < Ydp[0])
		res.pref.push_back({X.r, X.Asum, 0});

	for(int i = 0; i < sz(Y.pref); i++)
		if(A[Y.pref[i].i + 1] > Y.pref[i].Asum + X.Asum)
			res.pref.push_back({Y.pref[i].i, Y.pref[i].Asum + X.Asum, 0});



	res.suff = Y.suff;

	int si = sz(res.suff);

	if(Y.Asum < Xdp[0])
		res.suff.push_back({Y.l, Y.Asum, 0});

	for(int i = 0; i < sz(X.suff); i++)
		if(A[X.suff[i].i - 1] > X.suff[i].Asum + Y.Asum)
			res.suff.push_back({X.suff[i].i, X.suff[i].Asum + Y.Asum, 0});


	// cerr << "#4\n";

	vpii newpref, newsuff;

	for(xi = 0; xi <= Xs; xi++)
	{
		int xiwinners = (xi == Xs ? X.winners : X.suff[xi].winners);

		if(XXreach[xi] == Xs && XYreach[xi] == Ys)
			res.winners += xiwinners;
		else if(XXreach[xi] == Xs)
		{
			newpref.push_back({XYreach[xi], xiwinners});
		}
		else if(XYreach[xi] == Ys)
			newsuff.push_back({XXreach[xi], xiwinners});
	}
	// cerr << "#4-1\n";

	for(yi = 0; yi <= Ys; yi++)
	{
		// cerr << "entered : " << yi << '\n';
		int yiwinners = (yi == Ys ? Y.winners : Y.pref[yi].winners);


		if(YXreach[yi] == Xs && YYreach[yi] == Ys)
			res.winners += yiwinners;
		else if(YXreach[yi] == Xs)
		{
			newpref.push_back({YYreach[yi], yiwinners});

		}
		else if(YYreach[yi] == Ys)
		{
			newsuff.push_back({YXreach[yi], yiwinners});
		}
	}

	// cerr << "#5\n";

	for(auto pr : newpref)
	{
		for(auto& respr : res.pref)
		{
			// assert(pr.first < sz(Y.pref));

			if(pr.first == -1 && respr.i == X.r)
				respr.winners += pr.second;
			else if(pr.first != -1 && respr.i == Y.pref[pr.first].i)
				respr.winners += pr.second;
		}
	}
	// cerr << "hello\n";

	for(auto sf : newsuff)
	{
		// cerr << sf.first << ' ' << sf.second << '\n';
		for(auto& ressf : res.suff)
		{
			assert(sf.first < sz(X.suff));

			// cerr << "   " << ressf.i << ' ' << ressf.Asum << ' ' << ressf.winners << '\n';

			// cerr << "sff = " <<  sf.first << '\n';
			// cerr << X.suff[sf.first.i] << '\n';

			if(sf.first == -1 && ressf.i == Y.l)
			{
				// cerr << "bye\n";
				ressf.winners += sf.second;
				// cerr << "bye done\n";
			}
			else if(sf.first != -1 && ressf.i == X.suff[sf.first].i)
			{
				// cerr << "bye2\n";
				ressf.winners += sf.second;
			}
		}
	}


	// Y = info(1);

	// return res;

	// cerr << "combine end\n";
}

info combine(const info& A, const info& B)
{
	info res;
	combine(res, A, B);
	return res;
}


struct segtree
{
	info v;
	segtree* left = NULL;
	segtree* right = NULL;

	segtree()
	{
		;
	}

	segtree(int L, int R)
	{
		if(L == R)
			v = info(L);
		else
		{
			left = new segtree(L, (L+R)/2);
			right = new segtree((L+R)/2+1, R);
			combine(v, left->v, right->v);
		}
	}

	void recompute(int I)
	{
		// cerr << "recompute : " << v.l << ' ' << v.r << ' ' << I << '\n';
		if(v.l == v.r)
			v = info(v.l);
		else
		{
			if(I <= (v.l+v.r)/2)
				left->recompute(I);
			else
				right->recompute(I);

			// cerr << "###\n";

			combine(v, left->v, right->v);

			// cerr << "combine done\n";
		}
		// cerr << "done\n";
	}

	info range(int L, int R)
	{
		if(L <= v.l && v.r <= R)
			return v;
		else if(R <= (v.l+v.r)/2)
			return left->range(L, R);
		else if(L >= (v.l+v.r)/2+1)
			return right->range(L, R);
		else
			return combine(left->range(L, R), right->range(L, R));
	}
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N;
	A = vll(1+N);
	for(int i = 1; i <= N; i++)
		cin >> A[i];

	// cerr << "done\n";

	segtree S(1, N);

	// cerr << "done2\n";


	cin >> Q;
	for(int j = 1; j <= Q; j++)
	{
		int T;
		cin >> T;

		if(T == 1)
		{
			int X, Y;
			cin >> X >> Y;
			A[X] = Y;
			S.recompute(X);
			// cerr << "hello\n";
		}
		else
		{
			int L, R;
			cin >> L >> R;
			cout << S.range(L, R).winners << '\n';
		}
	}
}		

Compilation message

fish2.cpp: In function 'void combine(info&, const info&, const info&)':
fish2.cpp:163:6: warning: unused variable 'pi' [-Wunused-variable]
  163 |  int pi = sz(res.pref);
      |      ^~
fish2.cpp:176:6: warning: unused variable 'si' [-Wunused-variable]
  176 |  int si = sz(res.suff);
      |      ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 4 ms 456 KB Output is correct
17 Correct 2 ms 456 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 452 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 56 ms 32996 KB Output is correct
3 Correct 48 ms 30140 KB Output is correct
4 Correct 60 ms 32848 KB Output is correct
5 Correct 60 ms 30372 KB Output is correct
6 Correct 44 ms 24756 KB Output is correct
7 Correct 40 ms 24040 KB Output is correct
8 Correct 42 ms 24664 KB Output is correct
9 Correct 41 ms 24104 KB Output is correct
10 Correct 58 ms 33344 KB Output is correct
11 Correct 53 ms 28128 KB Output is correct
12 Correct 37 ms 23680 KB Output is correct
13 Correct 36 ms 23752 KB Output is correct
14 Correct 47 ms 25420 KB Output is correct
15 Correct 46 ms 25780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 4 ms 456 KB Output is correct
17 Correct 2 ms 456 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 452 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 56 ms 32996 KB Output is correct
23 Correct 48 ms 30140 KB Output is correct
24 Correct 60 ms 32848 KB Output is correct
25 Correct 60 ms 30372 KB Output is correct
26 Correct 44 ms 24756 KB Output is correct
27 Correct 40 ms 24040 KB Output is correct
28 Correct 42 ms 24664 KB Output is correct
29 Correct 41 ms 24104 KB Output is correct
30 Correct 58 ms 33344 KB Output is correct
31 Correct 53 ms 28128 KB Output is correct
32 Correct 37 ms 23680 KB Output is correct
33 Correct 36 ms 23752 KB Output is correct
34 Correct 47 ms 25420 KB Output is correct
35 Correct 46 ms 25780 KB Output is correct
36 Correct 61 ms 33212 KB Output is correct
37 Correct 62 ms 30320 KB Output is correct
38 Correct 66 ms 30276 KB Output is correct
39 Correct 64 ms 33216 KB Output is correct
40 Correct 62 ms 30216 KB Output is correct
41 Correct 52 ms 24772 KB Output is correct
42 Correct 48 ms 24676 KB Output is correct
43 Correct 52 ms 24232 KB Output is correct
44 Correct 55 ms 24092 KB Output is correct
45 Correct 67 ms 33232 KB Output is correct
46 Correct 63 ms 33292 KB Output is correct
47 Correct 56 ms 27244 KB Output is correct
48 Correct 42 ms 23900 KB Output is correct
49 Correct 46 ms 23780 KB Output is correct
50 Correct 49 ms 25504 KB Output is correct
51 Correct 50 ms 25832 KB Output is correct
52 Correct 51 ms 25508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 56 ms 32996 KB Output is correct
3 Correct 48 ms 30140 KB Output is correct
4 Correct 60 ms 32848 KB Output is correct
5 Correct 60 ms 30372 KB Output is correct
6 Correct 44 ms 24756 KB Output is correct
7 Correct 40 ms 24040 KB Output is correct
8 Correct 42 ms 24664 KB Output is correct
9 Correct 41 ms 24104 KB Output is correct
10 Correct 58 ms 33344 KB Output is correct
11 Correct 53 ms 28128 KB Output is correct
12 Correct 37 ms 23680 KB Output is correct
13 Correct 36 ms 23752 KB Output is correct
14 Correct 47 ms 25420 KB Output is correct
15 Correct 46 ms 25780 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1140 ms 32072 KB Output is correct
18 Correct 912 ms 35028 KB Output is correct
19 Correct 1230 ms 32472 KB Output is correct
20 Correct 1109 ms 32024 KB Output is correct
21 Correct 1151 ms 31952 KB Output is correct
22 Correct 919 ms 34968 KB Output is correct
23 Correct 1157 ms 31788 KB Output is correct
24 Correct 1091 ms 32148 KB Output is correct
25 Correct 1145 ms 32012 KB Output is correct
26 Correct 1108 ms 32112 KB Output is correct
27 Correct 524 ms 26656 KB Output is correct
28 Correct 544 ms 26804 KB Output is correct
29 Correct 533 ms 26704 KB Output is correct
30 Correct 843 ms 25696 KB Output is correct
31 Correct 781 ms 25544 KB Output is correct
32 Correct 1173 ms 29664 KB Output is correct
33 Correct 1062 ms 35364 KB Output is correct
34 Correct 1217 ms 29284 KB Output is correct
35 Correct 1171 ms 28524 KB Output is correct
36 Correct 1166 ms 34900 KB Output is correct
37 Correct 528 ms 25296 KB Output is correct
38 Correct 456 ms 25292 KB Output is correct
39 Correct 626 ms 27340 KB Output is correct
40 Correct 673 ms 27612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 56 ms 32996 KB Output is correct
3 Correct 48 ms 30140 KB Output is correct
4 Correct 60 ms 32848 KB Output is correct
5 Correct 60 ms 30372 KB Output is correct
6 Correct 44 ms 24756 KB Output is correct
7 Correct 40 ms 24040 KB Output is correct
8 Correct 42 ms 24664 KB Output is correct
9 Correct 41 ms 24104 KB Output is correct
10 Correct 58 ms 33344 KB Output is correct
11 Correct 53 ms 28128 KB Output is correct
12 Correct 37 ms 23680 KB Output is correct
13 Correct 36 ms 23752 KB Output is correct
14 Correct 47 ms 25420 KB Output is correct
15 Correct 46 ms 25780 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 663 ms 35172 KB Output is correct
18 Correct 488 ms 35896 KB Output is correct
19 Correct 541 ms 31728 KB Output is correct
20 Correct 381 ms 35496 KB Output is correct
21 Correct 592 ms 35088 KB Output is correct
22 Correct 551 ms 35788 KB Output is correct
23 Correct 679 ms 31492 KB Output is correct
24 Correct 450 ms 35732 KB Output is correct
25 Correct 560 ms 31448 KB Output is correct
26 Correct 239 ms 27896 KB Output is correct
27 Correct 361 ms 28360 KB Output is correct
28 Correct 327 ms 29992 KB Output is correct
29 Correct 273 ms 28132 KB Output is correct
30 Correct 358 ms 28108 KB Output is correct
31 Correct 401 ms 30432 KB Output is correct
32 Correct 508 ms 34248 KB Output is correct
33 Correct 702 ms 29404 KB Output is correct
34 Correct 432 ms 37528 KB Output is correct
35 Correct 505 ms 34880 KB Output is correct
36 Correct 417 ms 33460 KB Output is correct
37 Correct 378 ms 28996 KB Output is correct
38 Correct 248 ms 28264 KB Output is correct
39 Correct 305 ms 29192 KB Output is correct
40 Correct 149 ms 28340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 4 ms 456 KB Output is correct
17 Correct 2 ms 456 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 452 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 56 ms 32996 KB Output is correct
23 Correct 48 ms 30140 KB Output is correct
24 Correct 60 ms 32848 KB Output is correct
25 Correct 60 ms 30372 KB Output is correct
26 Correct 44 ms 24756 KB Output is correct
27 Correct 40 ms 24040 KB Output is correct
28 Correct 42 ms 24664 KB Output is correct
29 Correct 41 ms 24104 KB Output is correct
30 Correct 58 ms 33344 KB Output is correct
31 Correct 53 ms 28128 KB Output is correct
32 Correct 37 ms 23680 KB Output is correct
33 Correct 36 ms 23752 KB Output is correct
34 Correct 47 ms 25420 KB Output is correct
35 Correct 46 ms 25780 KB Output is correct
36 Correct 61 ms 33212 KB Output is correct
37 Correct 62 ms 30320 KB Output is correct
38 Correct 66 ms 30276 KB Output is correct
39 Correct 64 ms 33216 KB Output is correct
40 Correct 62 ms 30216 KB Output is correct
41 Correct 52 ms 24772 KB Output is correct
42 Correct 48 ms 24676 KB Output is correct
43 Correct 52 ms 24232 KB Output is correct
44 Correct 55 ms 24092 KB Output is correct
45 Correct 67 ms 33232 KB Output is correct
46 Correct 63 ms 33292 KB Output is correct
47 Correct 56 ms 27244 KB Output is correct
48 Correct 42 ms 23900 KB Output is correct
49 Correct 46 ms 23780 KB Output is correct
50 Correct 49 ms 25504 KB Output is correct
51 Correct 50 ms 25832 KB Output is correct
52 Correct 51 ms 25508 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1140 ms 32072 KB Output is correct
55 Correct 912 ms 35028 KB Output is correct
56 Correct 1230 ms 32472 KB Output is correct
57 Correct 1109 ms 32024 KB Output is correct
58 Correct 1151 ms 31952 KB Output is correct
59 Correct 919 ms 34968 KB Output is correct
60 Correct 1157 ms 31788 KB Output is correct
61 Correct 1091 ms 32148 KB Output is correct
62 Correct 1145 ms 32012 KB Output is correct
63 Correct 1108 ms 32112 KB Output is correct
64 Correct 524 ms 26656 KB Output is correct
65 Correct 544 ms 26804 KB Output is correct
66 Correct 533 ms 26704 KB Output is correct
67 Correct 843 ms 25696 KB Output is correct
68 Correct 781 ms 25544 KB Output is correct
69 Correct 1173 ms 29664 KB Output is correct
70 Correct 1062 ms 35364 KB Output is correct
71 Correct 1217 ms 29284 KB Output is correct
72 Correct 1171 ms 28524 KB Output is correct
73 Correct 1166 ms 34900 KB Output is correct
74 Correct 528 ms 25296 KB Output is correct
75 Correct 456 ms 25292 KB Output is correct
76 Correct 626 ms 27340 KB Output is correct
77 Correct 673 ms 27612 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 663 ms 35172 KB Output is correct
80 Correct 488 ms 35896 KB Output is correct
81 Correct 541 ms 31728 KB Output is correct
82 Correct 381 ms 35496 KB Output is correct
83 Correct 592 ms 35088 KB Output is correct
84 Correct 551 ms 35788 KB Output is correct
85 Correct 679 ms 31492 KB Output is correct
86 Correct 450 ms 35732 KB Output is correct
87 Correct 560 ms 31448 KB Output is correct
88 Correct 239 ms 27896 KB Output is correct
89 Correct 361 ms 28360 KB Output is correct
90 Correct 327 ms 29992 KB Output is correct
91 Correct 273 ms 28132 KB Output is correct
92 Correct 358 ms 28108 KB Output is correct
93 Correct 401 ms 30432 KB Output is correct
94 Correct 508 ms 34248 KB Output is correct
95 Correct 702 ms 29404 KB Output is correct
96 Correct 432 ms 37528 KB Output is correct
97 Correct 505 ms 34880 KB Output is correct
98 Correct 417 ms 33460 KB Output is correct
99 Correct 378 ms 28996 KB Output is correct
100 Correct 248 ms 28264 KB Output is correct
101 Correct 305 ms 29192 KB Output is correct
102 Correct 149 ms 28340 KB Output is correct
103 Correct 863 ms 31656 KB Output is correct
104 Correct 564 ms 37880 KB Output is correct
105 Correct 1091 ms 32268 KB Output is correct
106 Correct 915 ms 33652 KB Output is correct
107 Correct 847 ms 31772 KB Output is correct
108 Correct 579 ms 37920 KB Output is correct
109 Correct 1060 ms 31984 KB Output is correct
110 Correct 798 ms 34480 KB Output is correct
111 Correct 1136 ms 32152 KB Output is correct
112 Correct 952 ms 33348 KB Output is correct
113 Correct 409 ms 27960 KB Output is correct
114 Correct 540 ms 26908 KB Output is correct
115 Correct 516 ms 30476 KB Output is correct
116 Correct 667 ms 29464 KB Output is correct
117 Correct 534 ms 27200 KB Output is correct
118 Correct 768 ms 27616 KB Output is correct
119 Correct 381 ms 28104 KB Output is correct
120 Correct 623 ms 30284 KB Output is correct
121 Correct 713 ms 29048 KB Output is correct
122 Correct 562 ms 34216 KB Output is correct
123 Correct 1089 ms 29664 KB Output is correct
124 Correct 809 ms 31040 KB Output is correct
125 Correct 1118 ms 26572 KB Output is correct
126 Correct 879 ms 28552 KB Output is correct
127 Correct 580 ms 27516 KB Output is correct
128 Correct 639 ms 26852 KB Output is correct
129 Correct 540 ms 29240 KB Output is correct
130 Correct 599 ms 28576 KB Output is correct