답안 #674672

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674672 2022-12-25T18:29:01 Z QwertyPi Progression (NOI20_progression) C++14
100 / 100
1192 ms 103508 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MAXN = 3e5 + 11;

int d[MAXN];

struct SegTree{
	
	struct tag{
		tag() = default;
		tag(int _type, int _s, int _c) : type(_type), s(_s), c(_c) {};
		int type, s, c;
		
		void operator+= (const tag& t) {
			if(t.type == 1) s += t.s, c += t.c;
			else type = 2, s = t.s, c = t.c;
		}
		
		tag shift(int n) {
			return {type, s + n * c, c};
		}
		
		void pr() {
			printf("tag(%d %d %d)\n", type, s, c);
		}
	} lazy[MAXN << 2];
	
	struct node{
		int ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size;
		node() = default;
		node(int idx, int val) {
			if(idx == -1) { ans = -1; return; }
			ans = 1; _size = 1; pf_s = sf_s = val; pf_c = sf_c = 0; pf_x = sf_x = 1;
		}
		friend node operator+ (const node& a, const node& b) {
			if(a.ans == -1 || b.ans == -1) return a.ans == -1 ? b : a;
			node res; res.ans = max(a.ans, b.ans); res._size = a._size + b._size;
			
			res.pf_s = a.pf_s, res.pf_c = a.pf_c, res.pf_x = a.pf_x;
			if(a.pf_x == a._size){
				if(a._size == 1){
					res.pf_c = b.pf_s - a.sf_s;
					res.pf_x = res.pf_c == b.pf_c ? 1 + b.pf_x : 2;
				}else if(a.sf_s + a.sf_c == b.pf_s){
					res.pf_x = a.pf_x + (a.pf_c == b.pf_c ? b.pf_x : 1); 
				}
			}
			
			res.sf_s = b.sf_s, res.sf_c = b.sf_c, res.sf_x = b.sf_x;
			if(b.sf_x == b._size){
				if(b._size == 1){
					res.sf_c = b.pf_s - a.sf_s;
					res.sf_x = res.sf_c == a.sf_c ? 1 + a.sf_x : 2;
				}else if(a.sf_s + b.pf_c == b.pf_s){
					res.sf_x = b.sf_x + (b.sf_c == a.sf_c ? a.sf_x : 1); 
				}
			}

			res.ans = max(res.ans, max(res.pf_x, res.sf_x));
			res.ans = max(res.ans, 2LL);
			if(a.sf_s + b.pf_c == b.pf_s){
				res.ans = max(res.ans, 1 + b.pf_x);
			}
			if(a.sf_s + a.sf_c == b.pf_s){
				res.ans = max(res.ans, 1 + a.sf_x);
			}
			if(a.sf_s + a.sf_c == b.pf_s && a.sf_c == b.pf_c){
				res.ans = max(res.ans, a.sf_x + b.pf_x);
			}
			return res;
		}
		
		void operator+= (const tag& t) {
			if(t.type == 1) pf_s += t.s, pf_c += t.c, sf_s += t.s + t.c * (_size - 1), sf_c += t.c;
			else ans = pf_x = sf_x = _size, pf_s = t.s, pf_c = t.c, sf_s = t.s + t.c * (_size - 1), sf_c = t.c;
		}
		
		void pr() {
			printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
		}
	} t[MAXN << 2];
	
	void push(int v){
		t[v * 2 + 1] += lazy[v];
		lazy[v * 2 + 1] += lazy[v];
		t[v * 2 + 2] += lazy[v].shift(t[v * 2 + 1]._size);
		lazy[v * 2 + 2] += lazy[v].shift(t[v * 2 + 1]._size);
		lazy[v] = tag(1, 0, 0);
	}
	
	void build(int v, int l, int r){
		lazy[v] = tag(1, 0, 0);
		if(l == r) {
			t[v] = node(l, d[l]);
			return;
		}
		int m = (l + r) / 2;
		build(v * 2 + 1, l, m);
		build(v * 2 + 2, m + 1, r);
		t[v] = t[v * 2 + 1] + t[v * 2 + 2];
	}
	
	void patch(int ql, int qr, int s, int c, int v, int l, int r){
		if(qr < l || r < ql) return;
		if(ql <= l && r <= qr) {
			tag _t(1, s + c * (l - ql), c);
			lazy[v] += _t;
			t[v] += _t;
			return;
		}
		push(v);
		int m = (l + r) / 2;
		patch(ql, qr, s, c, v * 2 + 1, l, m);
		patch(ql, qr, s, c, v * 2 + 2, m + 1, r);
		t[v] = t[v * 2 + 1] + t[v * 2 + 2];
	}
	
	void rewrite(int ql, int qr, int s, int c, int v, int l, int r){
		if(qr < l || r < ql) return;
		if(ql <= l && r <= qr) {
			tag _t(2, s + c * (l - ql), c);
			lazy[v] += _t;
			t[v] += _t;
			return;
		}
		push(v);
		int m = (l + r) / 2;
		rewrite(ql, qr, s, c, v * 2 + 1, l, m);
		rewrite(ql, qr, s, c, v * 2 + 2, m + 1, r);
		t[v] = t[v * 2 + 1] + t[v * 2 + 2];
	}
	
	node eval(int ql, int qr, int v, int l, int r){
		if(qr < l || r < ql) return node(-1, 0);
		if(ql <= l && r <= qr) return t[v];
		push(v);
		int m = (l + r) / 2;
		node a = eval(ql, qr, v * 2 + 1, l, m);
		node b = eval(ql, qr, v * 2 + 2, m + 1, r);
		return a + b;
	}
} segTree;

int32_t main(){
	int n, q; cin >> n >> q;
	for(int i = 0; i < n; i++) cin >> d[i];
	segTree.build(0, 0, n - 1);
	for(int i = 0; i < q; i++){
		int ty, l, r, s, c; cin >> ty >> l >> r; l--; r--;
		if(ty == 1){
			cin >> s >> c;
			segTree.patch(l, r, s, c, 0, 0, n - 1);
		}else if(ty == 2){
			cin >> s >> c;
			segTree.rewrite(l, r, s, c, 0, 0, n - 1);
		}else{
			SegTree::node _node = segTree.eval(l, r, 0, 0, n - 1);
			cout << _node.ans << endl;
		}
	}
}

Compilation message

Progression.cpp: In member function 'void SegTree::tag::pr()':
Progression.cpp:26:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   26 |    printf("tag(%d %d %d)\n", type, s, c);
      |                ~^            ~~~~
      |                 |            |
      |                 int          long long int
      |                %lld
Progression.cpp:26:20: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
   26 |    printf("tag(%d %d %d)\n", type, s, c);
      |                   ~^               ~
      |                    |               |
      |                    int             long long int
      |                   %lld
Progression.cpp:26:23: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long long int' [-Wformat=]
   26 |    printf("tag(%d %d %d)\n", type, s, c);
      |                      ~^               ~
      |                       |               |
      |                       int             long long int
      |                      %lld
Progression.cpp: In member function 'void SegTree::node::pr()':
Progression.cpp:81:13: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |            ~^                                  ~~~
      |             |                                  |
      |             int                                long long int
      |            %lld
Progression.cpp:81:19: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                  ~^                                 ~~~~
      |                   |                                 |
      |                   int                               long long int
      |                  %lld
Progression.cpp:81:22: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                     ~^                                    ~~~~
      |                      |                                    |
      |                      int                                  long long int
      |                     %lld
Progression.cpp:81:25: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                        ~^                                       ~~~~
      |                         |                                       |
      |                         int                                     long long int
      |                        %lld
Progression.cpp:81:32: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                               ~^                                      ~~~~
      |                                |                                      |
      |                                int                                    long long int
      |                               %lld
Progression.cpp:81:35: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                                  ~^                                         ~~~~
      |                                   |                                         |
      |                                   int                                       long long int
      |                                  %lld
Progression.cpp:81:38: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                                     ~^                                            ~~~~
      |                                      |                                            |
      |                                      int                                          long long int
      |                                     %lld
Progression.cpp:81:42: warning: format '%d' expects argument of type 'int', but argument 9 has type 'long long int' [-Wformat=]
   81 |    printf("%d pf(%d %d %d) sf(%d %d %d) %d\n", ans, pf_s, pf_c, pf_x, sf_s, sf_c, sf_x, _size);
      |                                         ~^                                              ~~~~~
      |                                          |                                              |
      |                                          int                                            long long int
      |                                         %lld
# 결과 실행 시간 메모리 Grader output
1 Correct 523 ms 93872 KB Output is correct
2 Correct 344 ms 824 KB Output is correct
3 Correct 342 ms 844 KB Output is correct
4 Correct 323 ms 784 KB Output is correct
5 Correct 356 ms 860 KB Output is correct
6 Correct 323 ms 924 KB Output is correct
7 Correct 327 ms 808 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 524 ms 93816 KB Output is correct
12 Correct 567 ms 93732 KB Output is correct
13 Correct 526 ms 93976 KB Output is correct
14 Correct 533 ms 94176 KB Output is correct
15 Correct 532 ms 94112 KB Output is correct
16 Correct 535 ms 93852 KB Output is correct
17 Correct 544 ms 93672 KB Output is correct
18 Correct 537 ms 93680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 444 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 3 ms 468 KB Output is correct
13 Correct 3 ms 468 KB Output is correct
14 Correct 3 ms 448 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 3 ms 468 KB Output is correct
17 Correct 3 ms 440 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 2 ms 312 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 885 ms 94220 KB Output is correct
2 Correct 516 ms 1284 KB Output is correct
3 Correct 519 ms 1288 KB Output is correct
4 Correct 511 ms 1260 KB Output is correct
5 Correct 517 ms 1276 KB Output is correct
6 Correct 510 ms 1324 KB Output is correct
7 Correct 522 ms 1296 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 312 KB Output is correct
11 Correct 926 ms 94148 KB Output is correct
12 Correct 906 ms 94376 KB Output is correct
13 Correct 924 ms 94028 KB Output is correct
14 Correct 925 ms 94128 KB Output is correct
15 Correct 910 ms 94228 KB Output is correct
16 Correct 963 ms 94764 KB Output is correct
17 Correct 955 ms 94700 KB Output is correct
18 Correct 959 ms 94852 KB Output is correct
19 Correct 906 ms 94028 KB Output is correct
20 Correct 903 ms 93988 KB Output is correct
21 Correct 912 ms 94028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1130 ms 93476 KB Output is correct
2 Correct 351 ms 992 KB Output is correct
3 Correct 348 ms 720 KB Output is correct
4 Correct 349 ms 656 KB Output is correct
5 Correct 351 ms 648 KB Output is correct
6 Correct 356 ms 744 KB Output is correct
7 Correct 349 ms 748 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 867 ms 93400 KB Output is correct
12 Correct 938 ms 93652 KB Output is correct
13 Correct 869 ms 93476 KB Output is correct
14 Correct 868 ms 93476 KB Output is correct
15 Correct 898 ms 93432 KB Output is correct
16 Correct 973 ms 93644 KB Output is correct
17 Correct 995 ms 93564 KB Output is correct
18 Correct 973 ms 93492 KB Output is correct
19 Correct 956 ms 93416 KB Output is correct
20 Correct 936 ms 93436 KB Output is correct
21 Correct 927 ms 93524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 885 ms 94220 KB Output is correct
2 Correct 516 ms 1284 KB Output is correct
3 Correct 519 ms 1288 KB Output is correct
4 Correct 511 ms 1260 KB Output is correct
5 Correct 517 ms 1276 KB Output is correct
6 Correct 510 ms 1324 KB Output is correct
7 Correct 522 ms 1296 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 312 KB Output is correct
11 Correct 926 ms 94148 KB Output is correct
12 Correct 906 ms 94376 KB Output is correct
13 Correct 924 ms 94028 KB Output is correct
14 Correct 925 ms 94128 KB Output is correct
15 Correct 910 ms 94228 KB Output is correct
16 Correct 963 ms 94764 KB Output is correct
17 Correct 955 ms 94700 KB Output is correct
18 Correct 959 ms 94852 KB Output is correct
19 Correct 906 ms 94028 KB Output is correct
20 Correct 903 ms 93988 KB Output is correct
21 Correct 912 ms 94028 KB Output is correct
22 Correct 1113 ms 93584 KB Output is correct
23 Correct 435 ms 832 KB Output is correct
24 Correct 397 ms 864 KB Output is correct
25 Correct 400 ms 844 KB Output is correct
26 Correct 404 ms 788 KB Output is correct
27 Correct 408 ms 796 KB Output is correct
28 Correct 414 ms 1020 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1088 ms 93600 KB Output is correct
33 Correct 1093 ms 93584 KB Output is correct
34 Correct 1079 ms 93528 KB Output is correct
35 Correct 1051 ms 93644 KB Output is correct
36 Correct 1068 ms 93844 KB Output is correct
37 Correct 1077 ms 93736 KB Output is correct
38 Correct 1092 ms 93632 KB Output is correct
39 Correct 1115 ms 93552 KB Output is correct
40 Correct 1165 ms 93560 KB Output is correct
41 Correct 1156 ms 93696 KB Output is correct
42 Correct 1152 ms 93616 KB Output is correct
43 Correct 1111 ms 93544 KB Output is correct
44 Correct 1106 ms 93556 KB Output is correct
45 Correct 1179 ms 93396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 523 ms 93872 KB Output is correct
2 Correct 344 ms 824 KB Output is correct
3 Correct 342 ms 844 KB Output is correct
4 Correct 323 ms 784 KB Output is correct
5 Correct 356 ms 860 KB Output is correct
6 Correct 323 ms 924 KB Output is correct
7 Correct 327 ms 808 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 524 ms 93816 KB Output is correct
12 Correct 567 ms 93732 KB Output is correct
13 Correct 526 ms 93976 KB Output is correct
14 Correct 533 ms 94176 KB Output is correct
15 Correct 532 ms 94112 KB Output is correct
16 Correct 535 ms 93852 KB Output is correct
17 Correct 544 ms 93672 KB Output is correct
18 Correct 537 ms 93680 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 3 ms 468 KB Output is correct
27 Correct 2 ms 468 KB Output is correct
28 Correct 2 ms 444 KB Output is correct
29 Correct 3 ms 468 KB Output is correct
30 Correct 3 ms 468 KB Output is correct
31 Correct 3 ms 468 KB Output is correct
32 Correct 3 ms 448 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 3 ms 468 KB Output is correct
35 Correct 3 ms 440 KB Output is correct
36 Correct 3 ms 468 KB Output is correct
37 Correct 2 ms 312 KB Output is correct
38 Correct 2 ms 212 KB Output is correct
39 Correct 2 ms 340 KB Output is correct
40 Correct 885 ms 94220 KB Output is correct
41 Correct 516 ms 1284 KB Output is correct
42 Correct 519 ms 1288 KB Output is correct
43 Correct 511 ms 1260 KB Output is correct
44 Correct 517 ms 1276 KB Output is correct
45 Correct 510 ms 1324 KB Output is correct
46 Correct 522 ms 1296 KB Output is correct
47 Correct 2 ms 212 KB Output is correct
48 Correct 2 ms 212 KB Output is correct
49 Correct 2 ms 312 KB Output is correct
50 Correct 926 ms 94148 KB Output is correct
51 Correct 906 ms 94376 KB Output is correct
52 Correct 924 ms 94028 KB Output is correct
53 Correct 925 ms 94128 KB Output is correct
54 Correct 910 ms 94228 KB Output is correct
55 Correct 963 ms 94764 KB Output is correct
56 Correct 955 ms 94700 KB Output is correct
57 Correct 959 ms 94852 KB Output is correct
58 Correct 906 ms 94028 KB Output is correct
59 Correct 903 ms 93988 KB Output is correct
60 Correct 912 ms 94028 KB Output is correct
61 Correct 1130 ms 93476 KB Output is correct
62 Correct 351 ms 992 KB Output is correct
63 Correct 348 ms 720 KB Output is correct
64 Correct 349 ms 656 KB Output is correct
65 Correct 351 ms 648 KB Output is correct
66 Correct 356 ms 744 KB Output is correct
67 Correct 349 ms 748 KB Output is correct
68 Correct 2 ms 340 KB Output is correct
69 Correct 2 ms 212 KB Output is correct
70 Correct 2 ms 340 KB Output is correct
71 Correct 867 ms 93400 KB Output is correct
72 Correct 938 ms 93652 KB Output is correct
73 Correct 869 ms 93476 KB Output is correct
74 Correct 868 ms 93476 KB Output is correct
75 Correct 898 ms 93432 KB Output is correct
76 Correct 973 ms 93644 KB Output is correct
77 Correct 995 ms 93564 KB Output is correct
78 Correct 973 ms 93492 KB Output is correct
79 Correct 956 ms 93416 KB Output is correct
80 Correct 936 ms 93436 KB Output is correct
81 Correct 927 ms 93524 KB Output is correct
82 Correct 1113 ms 93584 KB Output is correct
83 Correct 435 ms 832 KB Output is correct
84 Correct 397 ms 864 KB Output is correct
85 Correct 400 ms 844 KB Output is correct
86 Correct 404 ms 788 KB Output is correct
87 Correct 408 ms 796 KB Output is correct
88 Correct 414 ms 1020 KB Output is correct
89 Correct 2 ms 340 KB Output is correct
90 Correct 2 ms 212 KB Output is correct
91 Correct 2 ms 340 KB Output is correct
92 Correct 1088 ms 93600 KB Output is correct
93 Correct 1093 ms 93584 KB Output is correct
94 Correct 1079 ms 93528 KB Output is correct
95 Correct 1051 ms 93644 KB Output is correct
96 Correct 1068 ms 93844 KB Output is correct
97 Correct 1077 ms 93736 KB Output is correct
98 Correct 1092 ms 93632 KB Output is correct
99 Correct 1115 ms 93552 KB Output is correct
100 Correct 1165 ms 93560 KB Output is correct
101 Correct 1156 ms 93696 KB Output is correct
102 Correct 1152 ms 93616 KB Output is correct
103 Correct 1111 ms 93544 KB Output is correct
104 Correct 1106 ms 93556 KB Output is correct
105 Correct 1179 ms 93396 KB Output is correct
106 Correct 1184 ms 103204 KB Output is correct
107 Correct 416 ms 3648 KB Output is correct
108 Correct 397 ms 3736 KB Output is correct
109 Correct 376 ms 3648 KB Output is correct
110 Correct 2 ms 212 KB Output is correct
111 Correct 2 ms 212 KB Output is correct
112 Correct 2 ms 340 KB Output is correct
113 Correct 1139 ms 102248 KB Output is correct
114 Correct 1140 ms 102308 KB Output is correct
115 Correct 1140 ms 102268 KB Output is correct
116 Correct 1130 ms 102284 KB Output is correct
117 Correct 1173 ms 103320 KB Output is correct
118 Correct 1102 ms 102272 KB Output is correct
119 Correct 1147 ms 102300 KB Output is correct
120 Correct 964 ms 100780 KB Output is correct
121 Correct 974 ms 100728 KB Output is correct
122 Correct 1008 ms 100756 KB Output is correct
123 Correct 897 ms 99864 KB Output is correct
124 Correct 900 ms 99912 KB Output is correct
125 Correct 903 ms 99984 KB Output is correct
126 Correct 1076 ms 99964 KB Output is correct
127 Correct 1067 ms 100012 KB Output is correct
128 Correct 1154 ms 103372 KB Output is correct
129 Correct 1064 ms 99804 KB Output is correct
130 Correct 1101 ms 99956 KB Output is correct
131 Correct 1136 ms 100044 KB Output is correct
132 Correct 1112 ms 99964 KB Output is correct
133 Correct 1192 ms 103508 KB Output is correct
134 Correct 1151 ms 103396 KB Output is correct
135 Correct 1163 ms 103376 KB Output is correct
136 Correct 382 ms 3840 KB Output is correct
137 Correct 375 ms 3732 KB Output is correct
138 Correct 382 ms 3908 KB Output is correct