답안 #111297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111297 2019-05-14T16:54:38 Z atoiz Alternating Current (BOI18_alternating) C++14
100 / 100
46 ms 4588 KB
/*input
5 4
1 3
2 4
4 5
5 1
*/

#include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <numeric>
#include <climits>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORA(i, a) for (auto &i : a)
#define FORB(i, a, b) for (int i = a; i >= b; --i)
#define SZ(a) ((int) a.size())
#define ALL(a) begin(a), end(a)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define fi first
#define se second

// start of code


struct Seg
{
	int l, r, i;
	bool operator< (const Seg &s) const
	{
		return (l == s.l ? r > s.r : l < s.l);
	}
};

const int MAXN = 200007;
int N, M;
int cover[MAXN], par[MAXN], newIdx[MAXN], cnt, tmp, ptr;
vector<Seg> segs, segs1;
bool color[MAXN];

void addCover(Seg s, int _N = N)
{
	assert(s.l <= _N);
	if (s.r <= _N) {
		++ cover[s.l];
		-- cover[s.r + 1];
	} else {
		++ cover[s.l];
		-- cover[_N + 1];
		++ cover[1];
		-- cover[s.r - _N + 1];
	}
}

signed main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	// read
	cin >> N >> M;
	segs.resize(M);
	for (int i = 0; i < M; ++i) {
		cin >> segs[i].l >> segs[i].r;
		if (segs[i].l > segs[i].r) segs[i].r += N;
		segs[i].i = i;
		par[i] = -1;
	}

	// re-organize
	ptr = 0;
	for (int i = 1; i < M; ++i) {
		if (segs[i].r - segs[i].l > segs[ptr].r - segs[ptr].l) {
			ptr = i;
		}
	}

	int shiftBack = segs[ptr].l - 1;
	for (int i = 0; i < M; ++i) {
		segs[i].l -= shiftBack, segs[i].r -= shiftBack;
		if (segs[i].l <= 0) segs[i].l += N, segs[i].r += N;
	}

	// sort
	sort(segs.begin(), segs.end());

	// cout << "-1-" << endl;
	// for (Seg &s : segs) cout << s.l << ' ' << s.r << ": " << s.i << endl;
	// cout << "--" << endl;

	// remove interiors
	for (int i = 1; i <= N; ++i) cover[i] = 0;
	int ptr = 0; segs1.push_back(segs[0]);
	for (int i = 1; i < M; ++i) {
		if (segs[i].r <= segs[ptr].r) {
			par[segs[i].i] = segs[ptr].i;
			addCover(segs[i]);
		} else {
			ptr = i;
			segs1.push_back(segs[i]);
		}
	}
	segs1.swap(segs); segs1.clear();

	// calculate
	for (int i = 1; i <= N; ++i) {
		cover[i] += cover[i - 1];

		newIdx[i] = newIdx[i - 1];
		if (!cover[i]) ++newIdx[i];
	}
	int N2 = newIdx[N];
	for (int i = 1; i <= N; ++i) {
		newIdx[i + N] = newIdx[i] + N2;
	}

	// cout << "-2-" << endl;
	// for (Seg &s : segs) cout << s.l << ' ' << s.r << ": " << s.i << endl;
	// cout << "--" << endl;

	// for (int i = 1; i <= N; ++i) cout << cover[i]; cout << endl;

	for (Seg &s : segs) {
		s.l = newIdx[s.l - 1] + 1;
		s.r = newIdx[s.r];
		if (s.l > N2) s.l -= N2, s.r -= N2;
		if (s.l <= s.r) segs1.push_back(s);
	}

	// cout << "-3-" << endl;
	// for (Seg &s : segs1) cout << s.l << ' ' << s.r << ": " << s.i << endl;
	// cout << "--" << endl;

	for (int i = 1; i <= N; ++i) cover[i] = 0;
	for (Seg &s : segs1) addCover(s, N2);
	for (int i = 1; i <= N2; ++i) cover[i] += cover[i - 1];

	// check
	for (int i = 1; i <= N2; ++i) {
		if (cover[i] <= 1) return cout << "impossible\n", 0;
	}

	if (segs1.size() & 1) {
		if (segs1.size() == 1) return cout << "impossible\n", 0;

		bool flag = 0;
		for (int i = 0; i < (int) segs1.size() && !flag; ++i) {
			Seg sl = segs1[i - 2 < 0 ? i - 2 + segs1.size() : i - 2];
			Seg sm1 = segs1[i - 1 < 0 ? i - 1 + segs1.size() : i - 1];
			Seg sm2 = segs1[i];
			Seg sr = segs1[i + 1 >= (int) segs1.size() ? i + 1 - segs1.size() : i + 1];

			if (sm1.l < sl.l) sm1.l += N2, sm1.r += N2;
			if (sm2.l < sm1.l) sm2.l += N2, sm2.r += N2;
			if (sr.l < sm2.l) sr.l += N2, sr.r += N2;

			if (sl.r + 1 >= sr.l) {
				rotate(segs1.begin(), segs1.begin() + i, segs1.end());
				flag = 1;

				// cout << "-4-" << ' ' << i << endl;
				// for (Seg &s : segs1) cout << s.l << ' ' << s.r << ": " << s.i << endl;
				// cout << "--" << endl;
			}
		}

		if (!flag) return cout << "impossible\n", 0;
	}

	for (int i = 0; i < (int) segs1.size(); ++i) {
		color[segs1[i].i] = i & 1;
	}

	for (int i = 0; i < M; ++i) {
		if (par[i] >= 0) {
			color[i] = !color[par[i]];
		}
		cout << color[i];
	}
	cout << endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 3 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 3 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 304 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 2 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 3 ms 384 KB Output is correct
65 Correct 2 ms 384 KB Output is correct
66 Correct 3 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 412 KB Output is correct
69 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 3 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 304 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 2 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 3 ms 384 KB Output is correct
65 Correct 2 ms 384 KB Output is correct
66 Correct 3 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 412 KB Output is correct
69 Correct 3 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 3 ms 384 KB Output is correct
72 Correct 2 ms 384 KB Output is correct
73 Correct 2 ms 384 KB Output is correct
74 Correct 2 ms 384 KB Output is correct
75 Correct 2 ms 384 KB Output is correct
76 Correct 2 ms 384 KB Output is correct
77 Correct 2 ms 384 KB Output is correct
78 Correct 2 ms 384 KB Output is correct
79 Correct 2 ms 384 KB Output is correct
80 Correct 2 ms 384 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 2 ms 384 KB Output is correct
83 Correct 3 ms 384 KB Output is correct
84 Correct 3 ms 384 KB Output is correct
85 Correct 3 ms 384 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 3 ms 384 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 2 ms 384 KB Output is correct
92 Correct 2 ms 384 KB Output is correct
93 Correct 2 ms 384 KB Output is correct
94 Correct 2 ms 384 KB Output is correct
95 Correct 3 ms 384 KB Output is correct
96 Correct 2 ms 384 KB Output is correct
97 Correct 3 ms 512 KB Output is correct
98 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 3320 KB Output is correct
2 Correct 3 ms 1536 KB Output is correct
3 Correct 13 ms 2304 KB Output is correct
4 Correct 15 ms 2432 KB Output is correct
5 Correct 39 ms 3824 KB Output is correct
6 Correct 34 ms 3572 KB Output is correct
7 Correct 46 ms 3324 KB Output is correct
8 Correct 5 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 42 ms 3952 KB Output is correct
11 Correct 31 ms 3196 KB Output is correct
12 Correct 41 ms 3064 KB Output is correct
13 Correct 4 ms 1664 KB Output is correct
14 Correct 4 ms 1536 KB Output is correct
15 Correct 36 ms 3320 KB Output is correct
16 Correct 19 ms 3064 KB Output is correct
17 Correct 43 ms 3320 KB Output is correct
18 Correct 43 ms 2168 KB Output is correct
19 Correct 5 ms 1664 KB Output is correct
20 Correct 37 ms 3440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 3 ms 384 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 3 ms 304 KB Output is correct
43 Correct 3 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 2 ms 384 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 2 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 2 ms 384 KB Output is correct
56 Correct 2 ms 384 KB Output is correct
57 Correct 2 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 2 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 3 ms 384 KB Output is correct
65 Correct 2 ms 384 KB Output is correct
66 Correct 3 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 412 KB Output is correct
69 Correct 3 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 3 ms 384 KB Output is correct
72 Correct 2 ms 384 KB Output is correct
73 Correct 2 ms 384 KB Output is correct
74 Correct 2 ms 384 KB Output is correct
75 Correct 2 ms 384 KB Output is correct
76 Correct 2 ms 384 KB Output is correct
77 Correct 2 ms 384 KB Output is correct
78 Correct 2 ms 384 KB Output is correct
79 Correct 2 ms 384 KB Output is correct
80 Correct 2 ms 384 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 2 ms 384 KB Output is correct
83 Correct 3 ms 384 KB Output is correct
84 Correct 3 ms 384 KB Output is correct
85 Correct 3 ms 384 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 3 ms 384 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 2 ms 384 KB Output is correct
92 Correct 2 ms 384 KB Output is correct
93 Correct 2 ms 384 KB Output is correct
94 Correct 2 ms 384 KB Output is correct
95 Correct 3 ms 384 KB Output is correct
96 Correct 2 ms 384 KB Output is correct
97 Correct 3 ms 512 KB Output is correct
98 Correct 2 ms 384 KB Output is correct
99 Correct 26 ms 3320 KB Output is correct
100 Correct 3 ms 1536 KB Output is correct
101 Correct 13 ms 2304 KB Output is correct
102 Correct 15 ms 2432 KB Output is correct
103 Correct 39 ms 3824 KB Output is correct
104 Correct 34 ms 3572 KB Output is correct
105 Correct 46 ms 3324 KB Output is correct
106 Correct 5 ms 1536 KB Output is correct
107 Correct 3 ms 1536 KB Output is correct
108 Correct 42 ms 3952 KB Output is correct
109 Correct 31 ms 3196 KB Output is correct
110 Correct 41 ms 3064 KB Output is correct
111 Correct 4 ms 1664 KB Output is correct
112 Correct 4 ms 1536 KB Output is correct
113 Correct 36 ms 3320 KB Output is correct
114 Correct 19 ms 3064 KB Output is correct
115 Correct 43 ms 3320 KB Output is correct
116 Correct 43 ms 2168 KB Output is correct
117 Correct 5 ms 1664 KB Output is correct
118 Correct 37 ms 3440 KB Output is correct
119 Correct 4 ms 1536 KB Output is correct
120 Correct 34 ms 4588 KB Output is correct
121 Correct 25 ms 3568 KB Output is correct
122 Correct 2 ms 384 KB Output is correct
123 Correct 6 ms 1792 KB Output is correct
124 Correct 16 ms 2880 KB Output is correct
125 Correct 13 ms 2624 KB Output is correct
126 Correct 4 ms 1536 KB Output is correct
127 Correct 8 ms 1920 KB Output is correct
128 Correct 31 ms 4336 KB Output is correct
129 Correct 25 ms 3200 KB Output is correct
130 Correct 26 ms 3572 KB Output is correct
131 Correct 4 ms 1536 KB Output is correct
132 Correct 4 ms 1536 KB Output is correct
133 Correct 43 ms 4472 KB Output is correct
134 Correct 14 ms 2352 KB Output is correct
135 Correct 4 ms 1536 KB Output is correct
136 Correct 24 ms 3824 KB Output is correct
137 Correct 38 ms 3956 KB Output is correct
138 Correct 3 ms 1536 KB Output is correct