Submission #884471

# Submission time Handle Problem Language Result Execution time Memory
884471 2023-12-07T12:44:45 Z willychan Security Guard (JOI23_guard) C++17
100 / 100
809 ms 59752 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
struct node{
	ll prio;
	int u,v;
	node* cd=nullptr;
	node* sb=nullptr;
	int size = 1;
};


node* merge(node* a,node* b){
		if(a==nullptr) return b;
		if(b==nullptr) return a;
		if(a->prio>b->prio) {
			a->sb = b->cd;
			b->cd = a;
			b->size+=a->size;
			return b;
		}else{
			b->sb = a->cd;	
			a->cd = b;
			a->size+=b->size;
			return a;
		}
		assert(1==0);
		return a;
}

node* merge_sb(node *a){
	if(a==nullptr) return a;
	if(a->sb==nullptr) return a;
	return merge(merge(a,a->sb),merge_sb(a->sb->sb));
}
int get_size(node* a){
	if(a==nullptr) return 0;
	return a->size;
}

node* pop(node* a){
	assert(a!=nullptr);
	int z  = get_size(a);
	node* ans = merge_sb(a->cd);
	if(ans!=nullptr) ans->size = z-1;
	return ans;
}

const int N = 2e5+5;
int P[N];
int A[N];
int query(int x){
	if(x!=P[x])  P[x] = query(P[x]);
	return P[x];
}

void join(int a,int b){
	a = query(a);
	b = query(b);
	if(a==b) return;
	P[a]=b;
}


node* R[N];

ll cost[N];

priority_queue<pair<ll,int>,vector<pair<ll,int> > ,greater<pair<ll,int> > > pq;

bool taken[N];


int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,m,q;cin>>n>>m>>q;
	for(int i=1;i<=n;i++) P[i]=i;
	for(int i=1;i<=n;i++) cin>>A[i];
	ll additional = 0;
	vector<ll> ans(n);
	pair<ll,int> maxn = {-1,-1};
	pair<ll,int> minn = {1e18,-1};
	for(int i=1;i<=n;i++){
		ans[n-1]+=A[i];
		additional-=A[i];
		maxn = max(maxn,{A[i],i});
		minn = min(minn,{A[i],i});
	}
	additional+=maxn.first;
	int ONE = minn.second;
	ans[n-1]+=1LL*(n-2)*A[ONE];
	/*
	step?:
	find the smallest cost and the two component and merge them
	repeat
	find the smallest cost component
		define cost of a componet: minus a1 bridge and add cross componet edge
	global_min prioirty_queue inorder to get everything
		if the top of prioirty queue is not up to date (the cost is not the same) pop
		merge componet on the pop of priority queue, push the new one into prioirty_queue
		record the answer 
		repeat till added edge = 0
		the component's  union find set rrepresent it
	*/
	for(int i=0;i<m;i++){
		int u,v;cin>>u>>v;
		node* tempu = new node;
		tempu->prio = A[u]+A[v];
		tempu->u = u;
		tempu->v = v;
		R[u] = merge(R[u],tempu);
		node* tempv = new node;
		tempv->prio = A[u]+A[v];
		tempv->u = v;
		tempv->v = u;
		R[v] = merge(R[v],tempv);
	}
	for(int i=1;i<=n;i++){
		cost[i]	=  -(A[ONE]+A[i])+(R[i]->prio);
		pq.push({cost[i],i});
	}
	for(int i=n-2;i>=0;i--){
		pair<ll,int> cur = {-1,-1};
		while(pq.size()){
			cur = pq.top();
			pq.pop();
			if(taken[cur.second]) continue;
			if(cost[cur.second]!=cur.first) continue;
			break;
		}
		taken[cur.second]=1;
		ans[i] = ans[i+1]+cost[cur.second];
		int a = cur.second;
		int b = query(R[cur.second]->v);
		join(a,b);
		R[b] = merge(R[a],R[b]);
		while(get_size(R[b])){
			if(query(R[b]->u)==query(R[b]->v)) R[b] = pop(R[b]);
			else break;
		}
		ll prev = cost[b];
		if(!get_size(R[b])) cost[b] = 1e15;
		else cost[b] = -(A[ONE]+A[b])+(R[b]->prio);
		if(cost[b]!=prev){
			pq.push({cost[b],b});
		}
	}
	for(int i=0;i<=q;i++){
		cout<<ans[min(i,n-1)]+additional<<"\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4696 KB Output is correct
2 Correct 70 ms 32968 KB Output is correct
3 Correct 70 ms 33732 KB Output is correct
4 Correct 90 ms 33736 KB Output is correct
5 Correct 91 ms 33616 KB Output is correct
6 Correct 90 ms 33984 KB Output is correct
7 Correct 90 ms 33452 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4696 KB Output is correct
2 Correct 70 ms 32968 KB Output is correct
3 Correct 70 ms 33732 KB Output is correct
4 Correct 90 ms 33736 KB Output is correct
5 Correct 91 ms 33616 KB Output is correct
6 Correct 90 ms 33984 KB Output is correct
7 Correct 90 ms 33452 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 175 ms 35676 KB Output is correct
11 Correct 79 ms 35528 KB Output is correct
12 Correct 90 ms 34240 KB Output is correct
13 Correct 94 ms 34704 KB Output is correct
14 Correct 156 ms 35784 KB Output is correct
15 Correct 150 ms 34332 KB Output is correct
16 Correct 157 ms 34544 KB Output is correct
17 Correct 157 ms 35728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4696 KB Output is correct
2 Correct 70 ms 32968 KB Output is correct
3 Correct 70 ms 33732 KB Output is correct
4 Correct 90 ms 33736 KB Output is correct
5 Correct 91 ms 33616 KB Output is correct
6 Correct 90 ms 33984 KB Output is correct
7 Correct 90 ms 33452 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 175 ms 35676 KB Output is correct
11 Correct 79 ms 35528 KB Output is correct
12 Correct 90 ms 34240 KB Output is correct
13 Correct 94 ms 34704 KB Output is correct
14 Correct 156 ms 35784 KB Output is correct
15 Correct 150 ms 34332 KB Output is correct
16 Correct 157 ms 34544 KB Output is correct
17 Correct 157 ms 35728 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 230 ms 36056 KB Output is correct
20 Correct 240 ms 34880 KB Output is correct
21 Correct 233 ms 34360 KB Output is correct
22 Correct 231 ms 35016 KB Output is correct
23 Correct 230 ms 34972 KB Output is correct
24 Correct 270 ms 35912 KB Output is correct
25 Correct 291 ms 34972 KB Output is correct
26 Correct 296 ms 34248 KB Output is correct
27 Correct 325 ms 34912 KB Output is correct
28 Correct 216 ms 35224 KB Output is correct
29 Correct 229 ms 36104 KB Output is correct
30 Correct 255 ms 36236 KB Output is correct
31 Correct 313 ms 35520 KB Output is correct
32 Correct 280 ms 34204 KB Output is correct
33 Correct 189 ms 35012 KB Output is correct
34 Correct 197 ms 34932 KB Output is correct
35 Correct 157 ms 35784 KB Output is correct
36 Correct 143 ms 36328 KB Output is correct
37 Correct 144 ms 35596 KB Output is correct
38 Correct 169 ms 35528 KB Output is correct
39 Correct 151 ms 35268 KB Output is correct
40 Correct 181 ms 35528 KB Output is correct
41 Correct 158 ms 34552 KB Output is correct
42 Correct 182 ms 35268 KB Output is correct
43 Correct 180 ms 35432 KB Output is correct
44 Correct 260 ms 34508 KB Output is correct
45 Correct 249 ms 35608 KB Output is correct
46 Correct 216 ms 36084 KB Output is correct
47 Correct 210 ms 35784 KB Output is correct
48 Correct 237 ms 35868 KB Output is correct
49 Correct 217 ms 34884 KB Output is correct
50 Correct 200 ms 35272 KB Output is correct
51 Correct 159 ms 34492 KB Output is correct
52 Correct 151 ms 32688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4696 KB Output is correct
2 Correct 70 ms 32968 KB Output is correct
3 Correct 70 ms 33732 KB Output is correct
4 Correct 90 ms 33736 KB Output is correct
5 Correct 91 ms 33616 KB Output is correct
6 Correct 90 ms 33984 KB Output is correct
7 Correct 90 ms 33452 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 175 ms 35676 KB Output is correct
11 Correct 79 ms 35528 KB Output is correct
12 Correct 90 ms 34240 KB Output is correct
13 Correct 94 ms 34704 KB Output is correct
14 Correct 156 ms 35784 KB Output is correct
15 Correct 150 ms 34332 KB Output is correct
16 Correct 157 ms 34544 KB Output is correct
17 Correct 157 ms 35728 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 230 ms 36056 KB Output is correct
20 Correct 240 ms 34880 KB Output is correct
21 Correct 233 ms 34360 KB Output is correct
22 Correct 231 ms 35016 KB Output is correct
23 Correct 230 ms 34972 KB Output is correct
24 Correct 270 ms 35912 KB Output is correct
25 Correct 291 ms 34972 KB Output is correct
26 Correct 296 ms 34248 KB Output is correct
27 Correct 325 ms 34912 KB Output is correct
28 Correct 216 ms 35224 KB Output is correct
29 Correct 229 ms 36104 KB Output is correct
30 Correct 255 ms 36236 KB Output is correct
31 Correct 313 ms 35520 KB Output is correct
32 Correct 280 ms 34204 KB Output is correct
33 Correct 189 ms 35012 KB Output is correct
34 Correct 197 ms 34932 KB Output is correct
35 Correct 157 ms 35784 KB Output is correct
36 Correct 143 ms 36328 KB Output is correct
37 Correct 144 ms 35596 KB Output is correct
38 Correct 169 ms 35528 KB Output is correct
39 Correct 151 ms 35268 KB Output is correct
40 Correct 181 ms 35528 KB Output is correct
41 Correct 158 ms 34552 KB Output is correct
42 Correct 182 ms 35268 KB Output is correct
43 Correct 180 ms 35432 KB Output is correct
44 Correct 260 ms 34508 KB Output is correct
45 Correct 249 ms 35608 KB Output is correct
46 Correct 216 ms 36084 KB Output is correct
47 Correct 210 ms 35784 KB Output is correct
48 Correct 237 ms 35868 KB Output is correct
49 Correct 217 ms 34884 KB Output is correct
50 Correct 200 ms 35272 KB Output is correct
51 Correct 159 ms 34492 KB Output is correct
52 Correct 151 ms 32688 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 241 ms 36892 KB Output is correct
55 Correct 221 ms 35860 KB Output is correct
56 Correct 287 ms 41236 KB Output is correct
57 Correct 596 ms 55988 KB Output is correct
58 Correct 508 ms 56956 KB Output is correct
59 Correct 542 ms 55620 KB Output is correct
60 Correct 437 ms 44736 KB Output is correct
61 Correct 721 ms 55496 KB Output is correct
62 Correct 809 ms 57660 KB Output is correct
63 Correct 231 ms 36264 KB Output is correct
64 Correct 383 ms 44576 KB Output is correct
65 Correct 621 ms 55596 KB Output is correct
66 Correct 779 ms 57120 KB Output is correct
67 Correct 637 ms 55568 KB Output is correct
68 Correct 222 ms 34148 KB Output is correct
69 Correct 348 ms 48944 KB Output is correct
70 Correct 216 ms 38768 KB Output is correct
71 Correct 153 ms 35492 KB Output is correct
72 Correct 139 ms 35012 KB Output is correct
73 Correct 156 ms 35848 KB Output is correct
74 Correct 152 ms 35780 KB Output is correct
75 Correct 156 ms 35224 KB Output is correct
76 Correct 158 ms 34276 KB Output is correct
77 Correct 174 ms 33804 KB Output is correct
78 Correct 207 ms 36152 KB Output is correct
79 Correct 645 ms 56684 KB Output is correct
80 Correct 249 ms 40388 KB Output is correct
81 Correct 385 ms 51996 KB Output is correct
82 Correct 468 ms 55552 KB Output is correct
83 Correct 531 ms 56304 KB Output is correct
84 Correct 498 ms 56012 KB Output is correct
85 Correct 206 ms 34828 KB Output is correct
86 Correct 162 ms 36260 KB Output is correct
87 Correct 156 ms 33012 KB Output is correct
88 Correct 689 ms 55496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 13 ms 6624 KB Output is correct
9 Correct 13 ms 6748 KB Output is correct
10 Correct 15 ms 6496 KB Output is correct
11 Correct 13 ms 6640 KB Output is correct
12 Correct 13 ms 6748 KB Output is correct
13 Correct 13 ms 6744 KB Output is correct
14 Correct 13 ms 6748 KB Output is correct
15 Correct 14 ms 6748 KB Output is correct
16 Correct 13 ms 6688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 13 ms 6624 KB Output is correct
9 Correct 13 ms 6748 KB Output is correct
10 Correct 15 ms 6496 KB Output is correct
11 Correct 13 ms 6640 KB Output is correct
12 Correct 13 ms 6748 KB Output is correct
13 Correct 13 ms 6744 KB Output is correct
14 Correct 13 ms 6748 KB Output is correct
15 Correct 14 ms 6748 KB Output is correct
16 Correct 13 ms 6688 KB Output is correct
17 Correct 28 ms 9300 KB Output is correct
18 Correct 27 ms 9512 KB Output is correct
19 Correct 67 ms 15496 KB Output is correct
20 Correct 241 ms 24996 KB Output is correct
21 Correct 258 ms 29524 KB Output is correct
22 Correct 162 ms 24856 KB Output is correct
23 Correct 584 ms 48212 KB Output is correct
24 Correct 270 ms 31416 KB Output is correct
25 Correct 17 ms 7004 KB Output is correct
26 Correct 103 ms 20216 KB Output is correct
27 Correct 25 ms 9688 KB Output is correct
28 Correct 14 ms 7260 KB Output is correct
29 Correct 14 ms 7260 KB Output is correct
30 Correct 15 ms 7256 KB Output is correct
31 Correct 13 ms 5980 KB Output is correct
32 Correct 12 ms 5976 KB Output is correct
33 Correct 16 ms 7516 KB Output is correct
34 Correct 21 ms 7944 KB Output is correct
35 Correct 95 ms 17068 KB Output is correct
36 Correct 709 ms 47964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4696 KB Output is correct
2 Correct 70 ms 32968 KB Output is correct
3 Correct 70 ms 33732 KB Output is correct
4 Correct 90 ms 33736 KB Output is correct
5 Correct 91 ms 33616 KB Output is correct
6 Correct 90 ms 33984 KB Output is correct
7 Correct 90 ms 33452 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 175 ms 35676 KB Output is correct
11 Correct 79 ms 35528 KB Output is correct
12 Correct 90 ms 34240 KB Output is correct
13 Correct 94 ms 34704 KB Output is correct
14 Correct 156 ms 35784 KB Output is correct
15 Correct 150 ms 34332 KB Output is correct
16 Correct 157 ms 34544 KB Output is correct
17 Correct 157 ms 35728 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 230 ms 36056 KB Output is correct
20 Correct 240 ms 34880 KB Output is correct
21 Correct 233 ms 34360 KB Output is correct
22 Correct 231 ms 35016 KB Output is correct
23 Correct 230 ms 34972 KB Output is correct
24 Correct 270 ms 35912 KB Output is correct
25 Correct 291 ms 34972 KB Output is correct
26 Correct 296 ms 34248 KB Output is correct
27 Correct 325 ms 34912 KB Output is correct
28 Correct 216 ms 35224 KB Output is correct
29 Correct 229 ms 36104 KB Output is correct
30 Correct 255 ms 36236 KB Output is correct
31 Correct 313 ms 35520 KB Output is correct
32 Correct 280 ms 34204 KB Output is correct
33 Correct 189 ms 35012 KB Output is correct
34 Correct 197 ms 34932 KB Output is correct
35 Correct 157 ms 35784 KB Output is correct
36 Correct 143 ms 36328 KB Output is correct
37 Correct 144 ms 35596 KB Output is correct
38 Correct 169 ms 35528 KB Output is correct
39 Correct 151 ms 35268 KB Output is correct
40 Correct 181 ms 35528 KB Output is correct
41 Correct 158 ms 34552 KB Output is correct
42 Correct 182 ms 35268 KB Output is correct
43 Correct 180 ms 35432 KB Output is correct
44 Correct 260 ms 34508 KB Output is correct
45 Correct 249 ms 35608 KB Output is correct
46 Correct 216 ms 36084 KB Output is correct
47 Correct 210 ms 35784 KB Output is correct
48 Correct 237 ms 35868 KB Output is correct
49 Correct 217 ms 34884 KB Output is correct
50 Correct 200 ms 35272 KB Output is correct
51 Correct 159 ms 34492 KB Output is correct
52 Correct 151 ms 32688 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 241 ms 36892 KB Output is correct
55 Correct 221 ms 35860 KB Output is correct
56 Correct 287 ms 41236 KB Output is correct
57 Correct 596 ms 55988 KB Output is correct
58 Correct 508 ms 56956 KB Output is correct
59 Correct 542 ms 55620 KB Output is correct
60 Correct 437 ms 44736 KB Output is correct
61 Correct 721 ms 55496 KB Output is correct
62 Correct 809 ms 57660 KB Output is correct
63 Correct 231 ms 36264 KB Output is correct
64 Correct 383 ms 44576 KB Output is correct
65 Correct 621 ms 55596 KB Output is correct
66 Correct 779 ms 57120 KB Output is correct
67 Correct 637 ms 55568 KB Output is correct
68 Correct 222 ms 34148 KB Output is correct
69 Correct 348 ms 48944 KB Output is correct
70 Correct 216 ms 38768 KB Output is correct
71 Correct 153 ms 35492 KB Output is correct
72 Correct 139 ms 35012 KB Output is correct
73 Correct 156 ms 35848 KB Output is correct
74 Correct 152 ms 35780 KB Output is correct
75 Correct 156 ms 35224 KB Output is correct
76 Correct 158 ms 34276 KB Output is correct
77 Correct 174 ms 33804 KB Output is correct
78 Correct 207 ms 36152 KB Output is correct
79 Correct 645 ms 56684 KB Output is correct
80 Correct 249 ms 40388 KB Output is correct
81 Correct 385 ms 51996 KB Output is correct
82 Correct 468 ms 55552 KB Output is correct
83 Correct 531 ms 56304 KB Output is correct
84 Correct 498 ms 56012 KB Output is correct
85 Correct 206 ms 34828 KB Output is correct
86 Correct 162 ms 36260 KB Output is correct
87 Correct 156 ms 33012 KB Output is correct
88 Correct 689 ms 55496 KB Output is correct
89 Correct 1 ms 4444 KB Output is correct
90 Correct 1 ms 4444 KB Output is correct
91 Correct 1 ms 4444 KB Output is correct
92 Correct 1 ms 4444 KB Output is correct
93 Correct 1 ms 4444 KB Output is correct
94 Correct 1 ms 4444 KB Output is correct
95 Correct 1 ms 4444 KB Output is correct
96 Correct 13 ms 6624 KB Output is correct
97 Correct 13 ms 6748 KB Output is correct
98 Correct 15 ms 6496 KB Output is correct
99 Correct 13 ms 6640 KB Output is correct
100 Correct 13 ms 6748 KB Output is correct
101 Correct 13 ms 6744 KB Output is correct
102 Correct 13 ms 6748 KB Output is correct
103 Correct 14 ms 6748 KB Output is correct
104 Correct 13 ms 6688 KB Output is correct
105 Correct 28 ms 9300 KB Output is correct
106 Correct 27 ms 9512 KB Output is correct
107 Correct 67 ms 15496 KB Output is correct
108 Correct 241 ms 24996 KB Output is correct
109 Correct 258 ms 29524 KB Output is correct
110 Correct 162 ms 24856 KB Output is correct
111 Correct 584 ms 48212 KB Output is correct
112 Correct 270 ms 31416 KB Output is correct
113 Correct 17 ms 7004 KB Output is correct
114 Correct 103 ms 20216 KB Output is correct
115 Correct 25 ms 9688 KB Output is correct
116 Correct 14 ms 7260 KB Output is correct
117 Correct 14 ms 7260 KB Output is correct
118 Correct 15 ms 7256 KB Output is correct
119 Correct 13 ms 5980 KB Output is correct
120 Correct 12 ms 5976 KB Output is correct
121 Correct 16 ms 7516 KB Output is correct
122 Correct 21 ms 7944 KB Output is correct
123 Correct 95 ms 17068 KB Output is correct
124 Correct 709 ms 47964 KB Output is correct
125 Correct 249 ms 37912 KB Output is correct
126 Correct 243 ms 38548 KB Output is correct
127 Correct 336 ms 42688 KB Output is correct
128 Correct 562 ms 57572 KB Output is correct
129 Correct 424 ms 51908 KB Output is correct
130 Correct 593 ms 57796 KB Output is correct
131 Correct 622 ms 58780 KB Output is correct
132 Correct 664 ms 59268 KB Output is correct
133 Correct 727 ms 59752 KB Output is correct
134 Correct 267 ms 39620 KB Output is correct
135 Correct 320 ms 42940 KB Output is correct
136 Correct 637 ms 58836 KB Output is correct
137 Correct 646 ms 59168 KB Output is correct
138 Correct 641 ms 57916 KB Output is correct
139 Correct 240 ms 35248 KB Output is correct
140 Correct 392 ms 49600 KB Output is correct
141 Correct 212 ms 38912 KB Output is correct
142 Correct 158 ms 36540 KB Output is correct
143 Correct 157 ms 36708 KB Output is correct
144 Correct 173 ms 36404 KB Output is correct
145 Correct 173 ms 36796 KB Output is correct
146 Correct 169 ms 36028 KB Output is correct
147 Correct 172 ms 35004 KB Output is correct
148 Correct 197 ms 34932 KB Output is correct
149 Correct 212 ms 36664 KB Output is correct
150 Correct 571 ms 57792 KB Output is correct
151 Correct 265 ms 42392 KB Output is correct
152 Correct 413 ms 58196 KB Output is correct
153 Correct 496 ms 57844 KB Output is correct
154 Correct 549 ms 57832 KB Output is correct
155 Correct 520 ms 57556 KB Output is correct
156 Correct 221 ms 36300 KB Output is correct
157 Correct 177 ms 37568 KB Output is correct
158 Correct 191 ms 33256 KB Output is correct
159 Correct 672 ms 57796 KB Output is correct