답안 #569204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
569204 2022-05-27T03:31:53 Z blue Fish 2 (JOI22_fish2) C++17
100 / 100
1149 ms 36176 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;

	int pi2 = pi;
	int si2 = si;

	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});

			int target = (XYreach[xi] == -1 ? X.r : Y.pref[XYreach[xi]].i);

			// // if(XYreach[xi] == -1)
			while(res.pref[pi2].i < target)
				pi2++;

			res.pref[pi2].winners += xiwinners;
		}
		else if(XYreach[xi] == Ys)
		{

			// newsuff.push_back({XXreach[xi], xiwinners});

			int target = X.suff[XXreach[xi]].i;
			while(res.suff[si2].i > target)
				si2++;

			res.suff[si2].winners += 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';
		}
	}
}		
# 결과 실행 시간 메모리 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 340 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 448 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 452 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 452 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 3 ms 468 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 2 ms 456 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 54 ms 33012 KB Output is correct
3 Correct 45 ms 30144 KB Output is correct
4 Correct 52 ms 32764 KB Output is correct
5 Correct 49 ms 30436 KB Output is correct
6 Correct 40 ms 24304 KB Output is correct
7 Correct 45 ms 24012 KB Output is correct
8 Correct 42 ms 24272 KB Output is correct
9 Correct 38 ms 24008 KB Output is correct
10 Correct 51 ms 33208 KB Output is correct
11 Correct 44 ms 28124 KB Output is correct
12 Correct 37 ms 23704 KB Output is correct
13 Correct 39 ms 23716 KB Output is correct
14 Correct 42 ms 25420 KB Output is correct
15 Correct 51 ms 25652 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 340 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 448 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 452 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 452 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 3 ms 468 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 2 ms 456 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 54 ms 33012 KB Output is correct
23 Correct 45 ms 30144 KB Output is correct
24 Correct 52 ms 32764 KB Output is correct
25 Correct 49 ms 30436 KB Output is correct
26 Correct 40 ms 24304 KB Output is correct
27 Correct 45 ms 24012 KB Output is correct
28 Correct 42 ms 24272 KB Output is correct
29 Correct 38 ms 24008 KB Output is correct
30 Correct 51 ms 33208 KB Output is correct
31 Correct 44 ms 28124 KB Output is correct
32 Correct 37 ms 23704 KB Output is correct
33 Correct 39 ms 23716 KB Output is correct
34 Correct 42 ms 25420 KB Output is correct
35 Correct 51 ms 25652 KB Output is correct
36 Correct 55 ms 33080 KB Output is correct
37 Correct 56 ms 30272 KB Output is correct
38 Correct 55 ms 30288 KB Output is correct
39 Correct 61 ms 33192 KB Output is correct
40 Correct 56 ms 30148 KB Output is correct
41 Correct 47 ms 24284 KB Output is correct
42 Correct 44 ms 24268 KB Output is correct
43 Correct 46 ms 24132 KB Output is correct
44 Correct 57 ms 24044 KB Output is correct
45 Correct 64 ms 33160 KB Output is correct
46 Correct 60 ms 33356 KB Output is correct
47 Correct 52 ms 27284 KB Output is correct
48 Correct 40 ms 23960 KB Output is correct
49 Correct 46 ms 23756 KB Output is correct
50 Correct 49 ms 25400 KB Output is correct
51 Correct 51 ms 25632 KB Output is correct
52 Correct 52 ms 25428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 54 ms 33012 KB Output is correct
3 Correct 45 ms 30144 KB Output is correct
4 Correct 52 ms 32764 KB Output is correct
5 Correct 49 ms 30436 KB Output is correct
6 Correct 40 ms 24304 KB Output is correct
7 Correct 45 ms 24012 KB Output is correct
8 Correct 42 ms 24272 KB Output is correct
9 Correct 38 ms 24008 KB Output is correct
10 Correct 51 ms 33208 KB Output is correct
11 Correct 44 ms 28124 KB Output is correct
12 Correct 37 ms 23704 KB Output is correct
13 Correct 39 ms 23716 KB Output is correct
14 Correct 42 ms 25420 KB Output is correct
15 Correct 51 ms 25652 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1084 ms 30936 KB Output is correct
18 Correct 945 ms 33608 KB Output is correct
19 Correct 1100 ms 30952 KB Output is correct
20 Correct 1146 ms 30680 KB Output is correct
21 Correct 1091 ms 30764 KB Output is correct
22 Correct 926 ms 33640 KB Output is correct
23 Correct 1059 ms 30708 KB Output is correct
24 Correct 1072 ms 30884 KB Output is correct
25 Correct 1074 ms 30832 KB Output is correct
26 Correct 1079 ms 30896 KB Output is correct
27 Correct 520 ms 24836 KB Output is correct
28 Correct 492 ms 24936 KB Output is correct
29 Correct 498 ms 24924 KB Output is correct
30 Correct 735 ms 24580 KB Output is correct
31 Correct 725 ms 24628 KB Output is correct
32 Correct 1027 ms 28552 KB Output is correct
33 Correct 992 ms 34104 KB Output is correct
34 Correct 1008 ms 28544 KB Output is correct
35 Correct 1029 ms 27484 KB Output is correct
36 Correct 964 ms 33480 KB Output is correct
37 Correct 526 ms 24244 KB Output is correct
38 Correct 445 ms 24320 KB Output is correct
39 Correct 606 ms 25972 KB Output is correct
40 Correct 629 ms 26440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 54 ms 33012 KB Output is correct
3 Correct 45 ms 30144 KB Output is correct
4 Correct 52 ms 32764 KB Output is correct
5 Correct 49 ms 30436 KB Output is correct
6 Correct 40 ms 24304 KB Output is correct
7 Correct 45 ms 24012 KB Output is correct
8 Correct 42 ms 24272 KB Output is correct
9 Correct 38 ms 24008 KB Output is correct
10 Correct 51 ms 33208 KB Output is correct
11 Correct 44 ms 28124 KB Output is correct
12 Correct 37 ms 23704 KB Output is correct
13 Correct 39 ms 23716 KB Output is correct
14 Correct 42 ms 25420 KB Output is correct
15 Correct 51 ms 25652 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 648 ms 34152 KB Output is correct
18 Correct 478 ms 34428 KB Output is correct
19 Correct 552 ms 30864 KB Output is correct
20 Correct 378 ms 34128 KB Output is correct
21 Correct 581 ms 34076 KB Output is correct
22 Correct 511 ms 34380 KB Output is correct
23 Correct 664 ms 30644 KB Output is correct
24 Correct 442 ms 34252 KB Output is correct
25 Correct 622 ms 30812 KB Output is correct
26 Correct 246 ms 25888 KB Output is correct
27 Correct 330 ms 26572 KB Output is correct
28 Correct 334 ms 28808 KB Output is correct
29 Correct 284 ms 26148 KB Output is correct
30 Correct 329 ms 26428 KB Output is correct
31 Correct 410 ms 29144 KB Output is correct
32 Correct 502 ms 32716 KB Output is correct
33 Correct 575 ms 28556 KB Output is correct
34 Correct 457 ms 35884 KB Output is correct
35 Correct 413 ms 33568 KB Output is correct
36 Correct 400 ms 31952 KB Output is correct
37 Correct 456 ms 27960 KB Output is correct
38 Correct 266 ms 27192 KB Output is correct
39 Correct 296 ms 27748 KB Output is correct
40 Correct 159 ms 27280 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 340 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 468 KB Output is correct
7 Correct 3 ms 448 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 452 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 452 KB Output is correct
13 Correct 2 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 3 ms 468 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 2 ms 456 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 54 ms 33012 KB Output is correct
23 Correct 45 ms 30144 KB Output is correct
24 Correct 52 ms 32764 KB Output is correct
25 Correct 49 ms 30436 KB Output is correct
26 Correct 40 ms 24304 KB Output is correct
27 Correct 45 ms 24012 KB Output is correct
28 Correct 42 ms 24272 KB Output is correct
29 Correct 38 ms 24008 KB Output is correct
30 Correct 51 ms 33208 KB Output is correct
31 Correct 44 ms 28124 KB Output is correct
32 Correct 37 ms 23704 KB Output is correct
33 Correct 39 ms 23716 KB Output is correct
34 Correct 42 ms 25420 KB Output is correct
35 Correct 51 ms 25652 KB Output is correct
36 Correct 55 ms 33080 KB Output is correct
37 Correct 56 ms 30272 KB Output is correct
38 Correct 55 ms 30288 KB Output is correct
39 Correct 61 ms 33192 KB Output is correct
40 Correct 56 ms 30148 KB Output is correct
41 Correct 47 ms 24284 KB Output is correct
42 Correct 44 ms 24268 KB Output is correct
43 Correct 46 ms 24132 KB Output is correct
44 Correct 57 ms 24044 KB Output is correct
45 Correct 64 ms 33160 KB Output is correct
46 Correct 60 ms 33356 KB Output is correct
47 Correct 52 ms 27284 KB Output is correct
48 Correct 40 ms 23960 KB Output is correct
49 Correct 46 ms 23756 KB Output is correct
50 Correct 49 ms 25400 KB Output is correct
51 Correct 51 ms 25632 KB Output is correct
52 Correct 52 ms 25428 KB Output is correct
53 Correct 0 ms 212 KB Output is correct
54 Correct 1084 ms 30936 KB Output is correct
55 Correct 945 ms 33608 KB Output is correct
56 Correct 1100 ms 30952 KB Output is correct
57 Correct 1146 ms 30680 KB Output is correct
58 Correct 1091 ms 30764 KB Output is correct
59 Correct 926 ms 33640 KB Output is correct
60 Correct 1059 ms 30708 KB Output is correct
61 Correct 1072 ms 30884 KB Output is correct
62 Correct 1074 ms 30832 KB Output is correct
63 Correct 1079 ms 30896 KB Output is correct
64 Correct 520 ms 24836 KB Output is correct
65 Correct 492 ms 24936 KB Output is correct
66 Correct 498 ms 24924 KB Output is correct
67 Correct 735 ms 24580 KB Output is correct
68 Correct 725 ms 24628 KB Output is correct
69 Correct 1027 ms 28552 KB Output is correct
70 Correct 992 ms 34104 KB Output is correct
71 Correct 1008 ms 28544 KB Output is correct
72 Correct 1029 ms 27484 KB Output is correct
73 Correct 964 ms 33480 KB Output is correct
74 Correct 526 ms 24244 KB Output is correct
75 Correct 445 ms 24320 KB Output is correct
76 Correct 606 ms 25972 KB Output is correct
77 Correct 629 ms 26440 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 648 ms 34152 KB Output is correct
80 Correct 478 ms 34428 KB Output is correct
81 Correct 552 ms 30864 KB Output is correct
82 Correct 378 ms 34128 KB Output is correct
83 Correct 581 ms 34076 KB Output is correct
84 Correct 511 ms 34380 KB Output is correct
85 Correct 664 ms 30644 KB Output is correct
86 Correct 442 ms 34252 KB Output is correct
87 Correct 622 ms 30812 KB Output is correct
88 Correct 246 ms 25888 KB Output is correct
89 Correct 330 ms 26572 KB Output is correct
90 Correct 334 ms 28808 KB Output is correct
91 Correct 284 ms 26148 KB Output is correct
92 Correct 329 ms 26428 KB Output is correct
93 Correct 410 ms 29144 KB Output is correct
94 Correct 502 ms 32716 KB Output is correct
95 Correct 575 ms 28556 KB Output is correct
96 Correct 457 ms 35884 KB Output is correct
97 Correct 413 ms 33568 KB Output is correct
98 Correct 400 ms 31952 KB Output is correct
99 Correct 456 ms 27960 KB Output is correct
100 Correct 266 ms 27192 KB Output is correct
101 Correct 296 ms 27748 KB Output is correct
102 Correct 159 ms 27280 KB Output is correct
103 Correct 864 ms 30784 KB Output is correct
104 Correct 517 ms 36176 KB Output is correct
105 Correct 1149 ms 31196 KB Output is correct
106 Correct 910 ms 32464 KB Output is correct
107 Correct 862 ms 31024 KB Output is correct
108 Correct 586 ms 36104 KB Output is correct
109 Correct 1029 ms 30924 KB Output is correct
110 Correct 771 ms 33412 KB Output is correct
111 Correct 1046 ms 31112 KB Output is correct
112 Correct 890 ms 32208 KB Output is correct
113 Correct 466 ms 26188 KB Output is correct
114 Correct 536 ms 25084 KB Output is correct
115 Correct 525 ms 29124 KB Output is correct
116 Correct 674 ms 28268 KB Output is correct
117 Correct 498 ms 25308 KB Output is correct
118 Correct 724 ms 26460 KB Output is correct
119 Correct 414 ms 26488 KB Output is correct
120 Correct 555 ms 28964 KB Output is correct
121 Correct 693 ms 27796 KB Output is correct
122 Correct 575 ms 32660 KB Output is correct
123 Correct 933 ms 28620 KB Output is correct
124 Correct 811 ms 29984 KB Output is correct
125 Correct 1047 ms 26576 KB Output is correct
126 Correct 867 ms 28644 KB Output is correct
127 Correct 571 ms 27600 KB Output is correct
128 Correct 575 ms 25684 KB Output is correct
129 Correct 522 ms 27688 KB Output is correct
130 Correct 604 ms 27164 KB Output is correct