Submission #389829

# Submission time Handle Problem Language Result Execution time Memory
389829 2021-04-14T15:07:58 Z ogibogi2004 Food Court (JOI21_foodcourt) C++14
100 / 100
959 ms 112452 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MAXN=250060;
struct node
{
	ll lazymax;
	ll lazyadd;
	ll maxhere;
};
node tree[4*MAXN];
void build(ll l,ll r,ll idx)
{
	tree[idx].maxhere=0;
	tree[idx].lazymax=0;
	tree[idx].lazyadd=0;
	if(l==r)return;
	ll mid=(l+r)/2;
	build(l,mid,idx*2);
	build(mid+1,r,idx*2+1);
}
node merge(node n1,node n2)
{
	node ret;
	ret.maxhere=max(0ll,max(max(n1.maxhere,n1.lazymax)+n1.lazyadd,max(n2.lazymax,n2.maxhere)+n2.lazyadd));
	ret.lazyadd=0;
	ret.lazymax=0;
	return ret;
}
void push_lazy(ll l,ll r,ll idx)
{
	//cout<<"&& "<<l<<" "<<r<<" "<<tree[idx].maxhere<<" "<<tree[idx].lazymax<<" "<<tree[idx].lazyadd<<endl;
	
	tree[idx].maxhere=max(tree[idx].maxhere,tree[idx].lazymax);
	tree[idx].maxhere+=tree[idx].lazyadd;
	tree[idx].maxhere=max(tree[idx].maxhere,0ll);
	//cout<<"& "<<tree[idx].maxhere<<endl;
	if(l!=r)
	{
		ll b1=tree[idx*2].lazymax;
		ll c1=tree[idx*2].lazyadd;
		ll b2=tree[idx].lazymax;
		ll c2=tree[idx].lazyadd;
		//if(l==4&&r==6)cout<<b1<<" "<<c1<<" "<<b2<<" "<<c2<<endl;
		tree[idx*2].lazymax=max(b1,b2-c1);
		tree[idx*2].lazyadd=c1+c2;
	}
	if(l!=r)
	{
		ll b1=tree[idx*2+1].lazymax;
		ll c1=tree[idx*2+1].lazyadd;
		ll b2=tree[idx].lazymax;
		ll c2=tree[idx].lazyadd;
		tree[idx*2+1].lazymax=max(b1,b2-c1);
		tree[idx*2+1].lazyadd=c1+c2;
	}
	tree[idx].lazymax=0;
	tree[idx].lazyadd=0;
}
void update(ll l,ll r,ll idx,ll ql,ll qr,ll val)
{
	push_lazy(l,r,idx);
	if(l>qr)return;
	if(r<ql)return;
	if(l>=ql&&r<=qr)
	{
		
		tree[idx].lazyadd+=val;
		push_lazy(l,r,idx);
		return;
	}
	ll mid=(l+r)/2;
	update(l,mid,idx*2,ql,qr,val);
	update(mid+1,r,idx*2+1,ql,qr,val);
	tree[idx]=merge(tree[idx*2],tree[idx*2+1]);
}
ll ask(ll l,ll r,ll idx,ll qi)
{
	/*if(l==4&&r==6)
		{
			cout<<tree[idx].lazymax<<" "<<tree[idx].lazyadd<<endl;
		}*/
	push_lazy(l,r,idx);
	if(l>qi||r<qi)return 0;
	if(l==r)return tree[idx].maxhere;
	ll mid=(l+r)/2;
	return max(ask(l,mid,idx*2,qi),ask(mid+1,r,idx*2+1,qi));
}
ll n,m,q;
void prll(ll l,ll r,ll idx)
{
	cout<<l<<" "<<r<<" "<<tree[idx].maxhere<<" "<<tree[idx].lazymax<<" "<<tree[idx].lazyadd<<endl;
	if(l==r)return;
	ll mid=(l+r)/2;
	prll(l,mid,idx*2);
	prll(mid+1,r,idx*2+1);
}
void updateMax(ll l,ll r,ll idx,ll ql,ll qr)
{
	push_lazy(l,r,idx);
	if(l>qr||r<ql)return;
	if(l>=ql&&r<=qr)
	{
		push_lazy(l,r,idx);
		return;
	}
	ll mid=(l+r)/2;
	updateMax(l,mid,idx*2,ql,qr);
	updateMax(mid+1,r,idx*2+1,ql,qr);
	tree[idx]=merge(tree[idx*2],tree[idx*2+1]);
}
struct BIT
{
	ll fen[MAXN];
	void init()
	{
		memset(fen,0,sizeof(fen));
	}
	void update(ll idx,ll val)
	{
		idx++;
		for(;idx<MAXN;idx+=idx&(-idx))
		{
			fen[idx]+=val;
		}
	}
	ll ask(ll idx)
	{
		idx++;
		ll ret=0;
		for(;idx>0;idx-=idx&(-idx))
		{
			ret+=fen[idx];
		}
		return ret;
	}
}ogi;
ll ans[MAXN];
vector<pair<ll,ll> >bs[MAXN];
struct upd
{
	ll type,l,r,c,k;
};
vector<upd>v;
struct query
{
	ll ind,b,pos;
};
vector<query>z;
ll low[MAXN],high[MAXN],ans1[MAXN];
vector<pair<query,ll> >toCheck[MAXN];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m>>q;
	build(1,n,1);
	for(ll i=0;i<q;++i)
	{
		ll type;
		cin>>type;
		if(type==1)
		{
			ll l,r,c,k;
			cin>>l>>r>>c>>k;
			update(1,n,1,l,r,k);
			ogi.update(l,+k);
			ogi.update(r+1,-k);
			v.push_back({type,l,r,c,k});
		}
		else if(type==2)
		{
			ll l,r,k;
			cin>>l>>r>>k;
			update(1,n,1,l,r,-k);
			v.push_back({type,l,r,0,k});
			//updateMax(1,n,1,l,r);
		}
		else
		{
			ll a,b;
			cin>>a>>b;
			ll t=ask(1,n,1,a);
			if(t>=b)
			{
				bs[a].push_back({ogi.ask(a)-(t-b),i});
			}
			v.push_back({type,0,0,0,0});
			//cout<<t<<endl;
		}
		//cout<<"------\n";
		//prll(1,n,1);
		//cout<<"-----\n";
	}
	/*cin>>n>>q;
	build(1,n,1);
	for(ll i=0;i<q;i++)
	{
		ll l,r,val;
		cin>>l>>r>>val;
		update(1,n,1,l,r,val);
		ll j;
		cin>>j;
		cout<<ask(1,n,1,j)<<endl;
		for(j=1;j<=n;j++)
		{
			cout<<ask(1,n,1,j)<<" ";
		}
		cout<<endl;
		prll(1,n,1);
	}*/
	for(ll i=1;i<=n;i++)
	{
		for(ll j=0;j<bs[i].size();j++)
		{
			z.push_back({i,bs[i][j].first,bs[i][j].second});
		}
	}
	for(ll i=0;i<z.size();i++)
	{
		low[i]=0;
		high[i]=q-1;
		//cout<<z[i].ind<<" "<<z[i].b<<" "<<z[i].pos<<endl;
	}
	ogi.init();
	for(ll step=0;step<19;++step)
	{
		for(ll i=0;i<z.size();++i)
		{
			if(low[i]<=high[i])
			{
				ll mid=(low[i]+high[i])/2;
				toCheck[mid].push_back({z[i],i});
			}
		}
		for(ll j=0;j<v.size();++j)
		{
			if(v[j].type==1)
			{
				ogi.update(v[j].l,+v[j].k);
				ogi.update(v[j].r+1,-v[j].k);
			}
			for(auto xd:toCheck[j])
			{
				if(ogi.ask(xd.first.ind)>=xd.first.b)
				{
					ans1[xd.second]=j;
					high[xd.second]=j-1;
				}
				else low[xd.second]=j+1;
			}
			toCheck[j].clear();
		}
		ogi.init();
	}
	for(ll i=0;i<z.size();++i)
	{
		//cout<<ans1[i]<<" "<<z[i].pos<<endl;
		ans[z[i].pos+1]=v[ans1[i]].c;
	}
	for(ll i=1;i<=q;++i)
	{
		if(v[i-1].type==3)
		{
			cout<<ans[i]<<'\n';
		}
	}
return 0;
}
/*
3 5 7
1 2 3 5 2
1 1 2 2 4
3 2 3
2 1 3 3
3 1 2
1 2 3 4 2
3 3 2
*/

Compilation message

foodcourt.cpp: In function 'int main()':
foodcourt.cpp:215:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  215 |   for(ll j=0;j<bs[i].size();j++)
      |              ~^~~~~~~~~~~~~
foodcourt.cpp:220:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<query>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  220 |  for(ll i=0;i<z.size();i++)
      |             ~^~~~~~~~~
foodcourt.cpp:229:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<query>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  229 |   for(ll i=0;i<z.size();++i)
      |              ~^~~~~~~~~
foodcourt.cpp:237:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<upd>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  237 |   for(ll j=0;j<v.size();++j)
      |              ~^~~~~~~~~
foodcourt.cpp:257:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<query>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  257 |  for(ll i=0;i<z.size();++i)
      |             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14284 KB Output is correct
2 Correct 14 ms 14476 KB Output is correct
3 Correct 13 ms 14340 KB Output is correct
4 Correct 14 ms 14344 KB Output is correct
5 Correct 13 ms 14348 KB Output is correct
6 Correct 13 ms 14336 KB Output is correct
7 Correct 14 ms 14440 KB Output is correct
8 Correct 15 ms 14412 KB Output is correct
9 Correct 14 ms 14436 KB Output is correct
10 Correct 14 ms 14404 KB Output is correct
11 Correct 14 ms 14424 KB Output is correct
12 Correct 14 ms 14320 KB Output is correct
13 Correct 13 ms 14432 KB Output is correct
14 Correct 14 ms 14412 KB Output is correct
15 Correct 15 ms 14412 KB Output is correct
16 Correct 16 ms 14540 KB Output is correct
17 Correct 14 ms 14244 KB Output is correct
18 Correct 14 ms 14412 KB Output is correct
19 Correct 14 ms 14284 KB Output is correct
20 Correct 15 ms 14284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14284 KB Output is correct
2 Correct 14 ms 14476 KB Output is correct
3 Correct 13 ms 14340 KB Output is correct
4 Correct 14 ms 14344 KB Output is correct
5 Correct 13 ms 14348 KB Output is correct
6 Correct 13 ms 14336 KB Output is correct
7 Correct 14 ms 14440 KB Output is correct
8 Correct 15 ms 14412 KB Output is correct
9 Correct 14 ms 14436 KB Output is correct
10 Correct 14 ms 14404 KB Output is correct
11 Correct 14 ms 14424 KB Output is correct
12 Correct 14 ms 14320 KB Output is correct
13 Correct 13 ms 14432 KB Output is correct
14 Correct 14 ms 14412 KB Output is correct
15 Correct 15 ms 14412 KB Output is correct
16 Correct 16 ms 14540 KB Output is correct
17 Correct 14 ms 14244 KB Output is correct
18 Correct 14 ms 14412 KB Output is correct
19 Correct 14 ms 14284 KB Output is correct
20 Correct 15 ms 14284 KB Output is correct
21 Correct 15 ms 14468 KB Output is correct
22 Correct 15 ms 14412 KB Output is correct
23 Correct 15 ms 14412 KB Output is correct
24 Correct 14 ms 14412 KB Output is correct
25 Correct 12 ms 14292 KB Output is correct
26 Correct 13 ms 14288 KB Output is correct
27 Correct 16 ms 14376 KB Output is correct
28 Correct 14 ms 14408 KB Output is correct
29 Correct 14 ms 14412 KB Output is correct
30 Correct 14 ms 14412 KB Output is correct
31 Correct 14 ms 14424 KB Output is correct
32 Correct 14 ms 14412 KB Output is correct
33 Correct 13 ms 14336 KB Output is correct
34 Correct 13 ms 14456 KB Output is correct
35 Correct 14 ms 14444 KB Output is correct
36 Correct 16 ms 14424 KB Output is correct
37 Correct 13 ms 14284 KB Output is correct
38 Correct 16 ms 14284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 19768 KB Output is correct
2 Correct 134 ms 19752 KB Output is correct
3 Correct 124 ms 19876 KB Output is correct
4 Correct 135 ms 19880 KB Output is correct
5 Correct 141 ms 19872 KB Output is correct
6 Correct 136 ms 19848 KB Output is correct
7 Correct 97 ms 21556 KB Output is correct
8 Correct 87 ms 22104 KB Output is correct
9 Correct 124 ms 20404 KB Output is correct
10 Correct 127 ms 19772 KB Output is correct
11 Correct 136 ms 19948 KB Output is correct
12 Correct 140 ms 19840 KB Output is correct
13 Correct 129 ms 23324 KB Output is correct
14 Correct 143 ms 23992 KB Output is correct
15 Correct 146 ms 20420 KB Output is correct
16 Correct 154 ms 20536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 721 ms 77864 KB Output is correct
2 Correct 569 ms 73480 KB Output is correct
3 Correct 797 ms 88052 KB Output is correct
4 Correct 625 ms 64416 KB Output is correct
5 Correct 649 ms 64796 KB Output is correct
6 Correct 827 ms 79464 KB Output is correct
7 Correct 359 ms 72744 KB Output is correct
8 Correct 377 ms 73128 KB Output is correct
9 Correct 882 ms 111828 KB Output is correct
10 Correct 880 ms 111536 KB Output is correct
11 Correct 760 ms 77516 KB Output is correct
12 Correct 856 ms 78608 KB Output is correct
13 Correct 746 ms 78004 KB Output is correct
14 Correct 766 ms 79152 KB Output is correct
15 Correct 787 ms 79388 KB Output is correct
16 Correct 777 ms 79652 KB Output is correct
17 Correct 851 ms 79888 KB Output is correct
18 Correct 766 ms 78584 KB Output is correct
19 Correct 796 ms 78972 KB Output is correct
20 Correct 785 ms 78632 KB Output is correct
21 Correct 796 ms 79416 KB Output is correct
22 Correct 862 ms 79432 KB Output is correct
23 Correct 901 ms 79420 KB Output is correct
24 Correct 847 ms 80032 KB Output is correct
25 Correct 706 ms 86656 KB Output is correct
26 Correct 715 ms 87764 KB Output is correct
27 Correct 634 ms 65876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14284 KB Output is correct
2 Correct 14 ms 14476 KB Output is correct
3 Correct 13 ms 14340 KB Output is correct
4 Correct 14 ms 14344 KB Output is correct
5 Correct 13 ms 14348 KB Output is correct
6 Correct 13 ms 14336 KB Output is correct
7 Correct 14 ms 14440 KB Output is correct
8 Correct 15 ms 14412 KB Output is correct
9 Correct 14 ms 14436 KB Output is correct
10 Correct 14 ms 14404 KB Output is correct
11 Correct 14 ms 14424 KB Output is correct
12 Correct 14 ms 14320 KB Output is correct
13 Correct 13 ms 14432 KB Output is correct
14 Correct 14 ms 14412 KB Output is correct
15 Correct 15 ms 14412 KB Output is correct
16 Correct 16 ms 14540 KB Output is correct
17 Correct 14 ms 14244 KB Output is correct
18 Correct 14 ms 14412 KB Output is correct
19 Correct 14 ms 14284 KB Output is correct
20 Correct 15 ms 14284 KB Output is correct
21 Correct 125 ms 19768 KB Output is correct
22 Correct 134 ms 19752 KB Output is correct
23 Correct 124 ms 19876 KB Output is correct
24 Correct 135 ms 19880 KB Output is correct
25 Correct 141 ms 19872 KB Output is correct
26 Correct 136 ms 19848 KB Output is correct
27 Correct 97 ms 21556 KB Output is correct
28 Correct 87 ms 22104 KB Output is correct
29 Correct 124 ms 20404 KB Output is correct
30 Correct 127 ms 19772 KB Output is correct
31 Correct 136 ms 19948 KB Output is correct
32 Correct 140 ms 19840 KB Output is correct
33 Correct 129 ms 23324 KB Output is correct
34 Correct 143 ms 23992 KB Output is correct
35 Correct 146 ms 20420 KB Output is correct
36 Correct 154 ms 20536 KB Output is correct
37 Correct 146 ms 29248 KB Output is correct
38 Correct 139 ms 25836 KB Output is correct
39 Correct 79 ms 23100 KB Output is correct
40 Correct 90 ms 24680 KB Output is correct
41 Correct 166 ms 28092 KB Output is correct
42 Correct 165 ms 28344 KB Output is correct
43 Correct 173 ms 28372 KB Output is correct
44 Correct 162 ms 28384 KB Output is correct
45 Correct 165 ms 28396 KB Output is correct
46 Correct 169 ms 28464 KB Output is correct
47 Correct 113 ms 30524 KB Output is correct
48 Correct 157 ms 30400 KB Output is correct
49 Correct 144 ms 23688 KB Output is correct
50 Correct 138 ms 24992 KB Output is correct
51 Correct 161 ms 27204 KB Output is correct
52 Correct 169 ms 27140 KB Output is correct
53 Correct 141 ms 19776 KB Output is correct
54 Correct 148 ms 20432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 34360 KB Output is correct
2 Correct 205 ms 36368 KB Output is correct
3 Correct 228 ms 36296 KB Output is correct
4 Correct 144 ms 30508 KB Output is correct
5 Correct 210 ms 34008 KB Output is correct
6 Correct 183 ms 36732 KB Output is correct
7 Correct 119 ms 30752 KB Output is correct
8 Correct 114 ms 29804 KB Output is correct
9 Correct 163 ms 36552 KB Output is correct
10 Correct 138 ms 30216 KB Output is correct
11 Correct 182 ms 36700 KB Output is correct
12 Correct 184 ms 36808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14284 KB Output is correct
2 Correct 14 ms 14476 KB Output is correct
3 Correct 13 ms 14340 KB Output is correct
4 Correct 14 ms 14344 KB Output is correct
5 Correct 13 ms 14348 KB Output is correct
6 Correct 13 ms 14336 KB Output is correct
7 Correct 14 ms 14440 KB Output is correct
8 Correct 15 ms 14412 KB Output is correct
9 Correct 14 ms 14436 KB Output is correct
10 Correct 14 ms 14404 KB Output is correct
11 Correct 14 ms 14424 KB Output is correct
12 Correct 14 ms 14320 KB Output is correct
13 Correct 13 ms 14432 KB Output is correct
14 Correct 14 ms 14412 KB Output is correct
15 Correct 15 ms 14412 KB Output is correct
16 Correct 16 ms 14540 KB Output is correct
17 Correct 14 ms 14244 KB Output is correct
18 Correct 14 ms 14412 KB Output is correct
19 Correct 14 ms 14284 KB Output is correct
20 Correct 15 ms 14284 KB Output is correct
21 Correct 15 ms 14468 KB Output is correct
22 Correct 15 ms 14412 KB Output is correct
23 Correct 15 ms 14412 KB Output is correct
24 Correct 14 ms 14412 KB Output is correct
25 Correct 12 ms 14292 KB Output is correct
26 Correct 13 ms 14288 KB Output is correct
27 Correct 16 ms 14376 KB Output is correct
28 Correct 14 ms 14408 KB Output is correct
29 Correct 14 ms 14412 KB Output is correct
30 Correct 14 ms 14412 KB Output is correct
31 Correct 14 ms 14424 KB Output is correct
32 Correct 14 ms 14412 KB Output is correct
33 Correct 13 ms 14336 KB Output is correct
34 Correct 13 ms 14456 KB Output is correct
35 Correct 14 ms 14444 KB Output is correct
36 Correct 16 ms 14424 KB Output is correct
37 Correct 13 ms 14284 KB Output is correct
38 Correct 16 ms 14284 KB Output is correct
39 Correct 125 ms 19768 KB Output is correct
40 Correct 134 ms 19752 KB Output is correct
41 Correct 124 ms 19876 KB Output is correct
42 Correct 135 ms 19880 KB Output is correct
43 Correct 141 ms 19872 KB Output is correct
44 Correct 136 ms 19848 KB Output is correct
45 Correct 97 ms 21556 KB Output is correct
46 Correct 87 ms 22104 KB Output is correct
47 Correct 124 ms 20404 KB Output is correct
48 Correct 127 ms 19772 KB Output is correct
49 Correct 136 ms 19948 KB Output is correct
50 Correct 140 ms 19840 KB Output is correct
51 Correct 129 ms 23324 KB Output is correct
52 Correct 143 ms 23992 KB Output is correct
53 Correct 146 ms 20420 KB Output is correct
54 Correct 154 ms 20536 KB Output is correct
55 Correct 146 ms 29248 KB Output is correct
56 Correct 139 ms 25836 KB Output is correct
57 Correct 79 ms 23100 KB Output is correct
58 Correct 90 ms 24680 KB Output is correct
59 Correct 166 ms 28092 KB Output is correct
60 Correct 165 ms 28344 KB Output is correct
61 Correct 173 ms 28372 KB Output is correct
62 Correct 162 ms 28384 KB Output is correct
63 Correct 165 ms 28396 KB Output is correct
64 Correct 169 ms 28464 KB Output is correct
65 Correct 113 ms 30524 KB Output is correct
66 Correct 157 ms 30400 KB Output is correct
67 Correct 144 ms 23688 KB Output is correct
68 Correct 138 ms 24992 KB Output is correct
69 Correct 161 ms 27204 KB Output is correct
70 Correct 169 ms 27140 KB Output is correct
71 Correct 141 ms 19776 KB Output is correct
72 Correct 148 ms 20432 KB Output is correct
73 Correct 183 ms 34360 KB Output is correct
74 Correct 205 ms 36368 KB Output is correct
75 Correct 228 ms 36296 KB Output is correct
76 Correct 144 ms 30508 KB Output is correct
77 Correct 210 ms 34008 KB Output is correct
78 Correct 183 ms 36732 KB Output is correct
79 Correct 119 ms 30752 KB Output is correct
80 Correct 114 ms 29804 KB Output is correct
81 Correct 163 ms 36552 KB Output is correct
82 Correct 138 ms 30216 KB Output is correct
83 Correct 182 ms 36700 KB Output is correct
84 Correct 184 ms 36808 KB Output is correct
85 Correct 154 ms 29472 KB Output is correct
86 Correct 171 ms 30656 KB Output is correct
87 Correct 195 ms 26912 KB Output is correct
88 Correct 176 ms 28432 KB Output is correct
89 Correct 129 ms 24432 KB Output is correct
90 Correct 204 ms 28340 KB Output is correct
91 Correct 153 ms 26556 KB Output is correct
92 Correct 127 ms 26268 KB Output is correct
93 Correct 169 ms 28732 KB Output is correct
94 Correct 190 ms 28392 KB Output is correct
95 Correct 172 ms 28328 KB Output is correct
96 Correct 174 ms 28356 KB Output is correct
97 Correct 187 ms 28348 KB Output is correct
98 Correct 169 ms 27164 KB Output is correct
99 Correct 121 ms 30620 KB Output is correct
100 Correct 150 ms 28844 KB Output is correct
101 Correct 169 ms 30552 KB Output is correct
102 Correct 191 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 14284 KB Output is correct
2 Correct 14 ms 14476 KB Output is correct
3 Correct 13 ms 14340 KB Output is correct
4 Correct 14 ms 14344 KB Output is correct
5 Correct 13 ms 14348 KB Output is correct
6 Correct 13 ms 14336 KB Output is correct
7 Correct 14 ms 14440 KB Output is correct
8 Correct 15 ms 14412 KB Output is correct
9 Correct 14 ms 14436 KB Output is correct
10 Correct 14 ms 14404 KB Output is correct
11 Correct 14 ms 14424 KB Output is correct
12 Correct 14 ms 14320 KB Output is correct
13 Correct 13 ms 14432 KB Output is correct
14 Correct 14 ms 14412 KB Output is correct
15 Correct 15 ms 14412 KB Output is correct
16 Correct 16 ms 14540 KB Output is correct
17 Correct 14 ms 14244 KB Output is correct
18 Correct 14 ms 14412 KB Output is correct
19 Correct 14 ms 14284 KB Output is correct
20 Correct 15 ms 14284 KB Output is correct
21 Correct 15 ms 14468 KB Output is correct
22 Correct 15 ms 14412 KB Output is correct
23 Correct 15 ms 14412 KB Output is correct
24 Correct 14 ms 14412 KB Output is correct
25 Correct 12 ms 14292 KB Output is correct
26 Correct 13 ms 14288 KB Output is correct
27 Correct 16 ms 14376 KB Output is correct
28 Correct 14 ms 14408 KB Output is correct
29 Correct 14 ms 14412 KB Output is correct
30 Correct 14 ms 14412 KB Output is correct
31 Correct 14 ms 14424 KB Output is correct
32 Correct 14 ms 14412 KB Output is correct
33 Correct 13 ms 14336 KB Output is correct
34 Correct 13 ms 14456 KB Output is correct
35 Correct 14 ms 14444 KB Output is correct
36 Correct 16 ms 14424 KB Output is correct
37 Correct 13 ms 14284 KB Output is correct
38 Correct 16 ms 14284 KB Output is correct
39 Correct 125 ms 19768 KB Output is correct
40 Correct 134 ms 19752 KB Output is correct
41 Correct 124 ms 19876 KB Output is correct
42 Correct 135 ms 19880 KB Output is correct
43 Correct 141 ms 19872 KB Output is correct
44 Correct 136 ms 19848 KB Output is correct
45 Correct 97 ms 21556 KB Output is correct
46 Correct 87 ms 22104 KB Output is correct
47 Correct 124 ms 20404 KB Output is correct
48 Correct 127 ms 19772 KB Output is correct
49 Correct 136 ms 19948 KB Output is correct
50 Correct 140 ms 19840 KB Output is correct
51 Correct 129 ms 23324 KB Output is correct
52 Correct 143 ms 23992 KB Output is correct
53 Correct 146 ms 20420 KB Output is correct
54 Correct 154 ms 20536 KB Output is correct
55 Correct 721 ms 77864 KB Output is correct
56 Correct 569 ms 73480 KB Output is correct
57 Correct 797 ms 88052 KB Output is correct
58 Correct 625 ms 64416 KB Output is correct
59 Correct 649 ms 64796 KB Output is correct
60 Correct 827 ms 79464 KB Output is correct
61 Correct 359 ms 72744 KB Output is correct
62 Correct 377 ms 73128 KB Output is correct
63 Correct 882 ms 111828 KB Output is correct
64 Correct 880 ms 111536 KB Output is correct
65 Correct 760 ms 77516 KB Output is correct
66 Correct 856 ms 78608 KB Output is correct
67 Correct 746 ms 78004 KB Output is correct
68 Correct 766 ms 79152 KB Output is correct
69 Correct 787 ms 79388 KB Output is correct
70 Correct 777 ms 79652 KB Output is correct
71 Correct 851 ms 79888 KB Output is correct
72 Correct 766 ms 78584 KB Output is correct
73 Correct 796 ms 78972 KB Output is correct
74 Correct 785 ms 78632 KB Output is correct
75 Correct 796 ms 79416 KB Output is correct
76 Correct 862 ms 79432 KB Output is correct
77 Correct 901 ms 79420 KB Output is correct
78 Correct 847 ms 80032 KB Output is correct
79 Correct 706 ms 86656 KB Output is correct
80 Correct 715 ms 87764 KB Output is correct
81 Correct 634 ms 65876 KB Output is correct
82 Correct 146 ms 29248 KB Output is correct
83 Correct 139 ms 25836 KB Output is correct
84 Correct 79 ms 23100 KB Output is correct
85 Correct 90 ms 24680 KB Output is correct
86 Correct 166 ms 28092 KB Output is correct
87 Correct 165 ms 28344 KB Output is correct
88 Correct 173 ms 28372 KB Output is correct
89 Correct 162 ms 28384 KB Output is correct
90 Correct 165 ms 28396 KB Output is correct
91 Correct 169 ms 28464 KB Output is correct
92 Correct 113 ms 30524 KB Output is correct
93 Correct 157 ms 30400 KB Output is correct
94 Correct 144 ms 23688 KB Output is correct
95 Correct 138 ms 24992 KB Output is correct
96 Correct 161 ms 27204 KB Output is correct
97 Correct 169 ms 27140 KB Output is correct
98 Correct 141 ms 19776 KB Output is correct
99 Correct 148 ms 20432 KB Output is correct
100 Correct 183 ms 34360 KB Output is correct
101 Correct 205 ms 36368 KB Output is correct
102 Correct 228 ms 36296 KB Output is correct
103 Correct 144 ms 30508 KB Output is correct
104 Correct 210 ms 34008 KB Output is correct
105 Correct 183 ms 36732 KB Output is correct
106 Correct 119 ms 30752 KB Output is correct
107 Correct 114 ms 29804 KB Output is correct
108 Correct 163 ms 36552 KB Output is correct
109 Correct 138 ms 30216 KB Output is correct
110 Correct 182 ms 36700 KB Output is correct
111 Correct 184 ms 36808 KB Output is correct
112 Correct 154 ms 29472 KB Output is correct
113 Correct 171 ms 30656 KB Output is correct
114 Correct 195 ms 26912 KB Output is correct
115 Correct 176 ms 28432 KB Output is correct
116 Correct 129 ms 24432 KB Output is correct
117 Correct 204 ms 28340 KB Output is correct
118 Correct 153 ms 26556 KB Output is correct
119 Correct 127 ms 26268 KB Output is correct
120 Correct 169 ms 28732 KB Output is correct
121 Correct 190 ms 28392 KB Output is correct
122 Correct 172 ms 28328 KB Output is correct
123 Correct 174 ms 28356 KB Output is correct
124 Correct 187 ms 28348 KB Output is correct
125 Correct 169 ms 27164 KB Output is correct
126 Correct 121 ms 30620 KB Output is correct
127 Correct 150 ms 28844 KB Output is correct
128 Correct 169 ms 30552 KB Output is correct
129 Correct 191 ms 25268 KB Output is correct
130 Correct 835 ms 88508 KB Output is correct
131 Correct 589 ms 73988 KB Output is correct
132 Correct 959 ms 88264 KB Output is correct
133 Correct 876 ms 76900 KB Output is correct
134 Correct 753 ms 71400 KB Output is correct
135 Correct 889 ms 80228 KB Output is correct
136 Correct 918 ms 111904 KB Output is correct
137 Correct 952 ms 112452 KB Output is correct
138 Correct 790 ms 77904 KB Output is correct
139 Correct 779 ms 79396 KB Output is correct
140 Correct 782 ms 79040 KB Output is correct
141 Correct 790 ms 79248 KB Output is correct
142 Correct 805 ms 80560 KB Output is correct
143 Correct 812 ms 80388 KB Output is correct
144 Correct 782 ms 78980 KB Output is correct
145 Correct 808 ms 79600 KB Output is correct
146 Correct 801 ms 79464 KB Output is correct
147 Correct 801 ms 79644 KB Output is correct
148 Correct 816 ms 80032 KB Output is correct
149 Correct 832 ms 80204 KB Output is correct
150 Correct 474 ms 87700 KB Output is correct
151 Correct 719 ms 88092 KB Output is correct
152 Correct 709 ms 88468 KB Output is correct
153 Correct 645 ms 66328 KB Output is correct