Submission #829010

# Submission time Handle Problem Language Result Execution time Memory
829010 2023-08-18T01:21:15 Z arnold518 Radio Towers (IOI22_towers) C++17
100 / 100
1100 ms 37944 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 1e5;
const int INF = 1e9+7;

int N, A[MAXN+10], B[MAXN+10], P[MAXN+10];
vector<int> comp;

struct SEG
{
	int tree[MAXN*4+10];
	void init(int node, int tl, int tr)
	{
		if(tl==tr)
		{
			tree[node]=A[tl];
			return;
		}
		int mid=tl+tr>>1;
		init(node*2, tl, mid);
		init(node*2+1, mid+1, tr);
		tree[node]=min(tree[node*2], tree[node*2+1]);
	}
	int query(int node, int tl, int tr, int l, int r)
	{
		if(r<tl || tr<l) return INF;
		if(l<=tl && tr<=r) return tree[node];
		int mid=tl+tr>>1;
		return min(query(node*2, tl, mid, l, r), query(node*2+1, mid+1, tr, l, r));
	}
}seg;

struct SEG2
{
	int tree[MAXN*4+10];
	void init(int node, int tl, int tr)
	{
		if(tl==tr)
		{
			tree[node]=P[tl];
			return;
		}
		int mid=tl+tr>>1;
		init(node*2, tl, mid);
		init(node*2+1, mid+1, tr);
		tree[node]=max(tree[node*2], tree[node*2+1]);
	}
	int query1(int node, int tl, int tr, int l, int r, int D)
	{
		if(r<tl || tr<l) return -1;
		if(l<=tl && tr<=r && tree[node]<D) return -1;
		if(tl==tr) return tl;
		int mid=tl+tr>>1;
		int ret=query1(node*2, tl, mid, l, r, D);
		if(ret!=-1) return ret;
		ret=query1(node*2+1, mid+1, tr, l, r, D);
		return ret;
	}
	int query2(int node, int tl, int tr, int l, int r, int D)
	{
		if(r<tl || tr<l) return -1;
		if(l<=tl && tr<=r && tree[node]<D) return -1;
		if(tl==tr) return tl;
		int mid=tl+tr>>1;
		int ret=query2(node*2+1, mid+1, tr, l, r, D);
		if(ret!=-1) return ret;
		ret=query2(node*2, tl, mid, l, r, D);
		return ret;
	}
}seg2;

struct PST
{
	struct Node
	{
		int val, lc, rc;
		Node() : val(0), lc(-1), rc(-1) {}
	};
	vector<Node> NS;
	int tree[MAXN+10];
	
	int newNode()
	{
		NS.push_back(Node());
		return NS.size()-1;
	}

	int makeTree(int tl, int tr)
	{
		int node=newNode();
		if(tl==tr) return node;
		int mid=tl+tr>>1;
		NS[node].lc=makeTree(tl, mid);
		NS[node].rc=makeTree(mid+1, tr);
		return node;
	}

	int addTree(int node, int tl, int tr, int p)
	{
		if(p<tl || tr<p) return node;
		int now=newNode();
		if(tl==tr)
		{
			NS[now].val=NS[node].val+1;
			return now;
		}
		int mid=tl+tr>>1;
		NS[now].lc=addTree(NS[node].lc, tl, mid, p);
		NS[now].rc=addTree(NS[node].rc, mid+1, tr, p);
		NS[now].val=NS[NS[now].lc].val+NS[NS[now].rc].val;
		return now;
	}

	int query(int node, int tl, int tr, int l, int r)
	{
		if(l<=tl && tr<=r) return NS[node].val;
		if(r<tl || tr<l) return 0;
		int mid=tl+tr>>1;
		return query(NS[node].lc, tl, mid, l, r)+query(NS[node].rc, mid+1, tr, l, r);
	}
}pst;

void init(int _N, vector<int> _H)
{
	N=_N;
	for(int i=1; i<=N; i++) A[i]=_H[i-1];
	seg.init(1, 1, N);

	vector<int> V;
	V.push_back(1);
	for(int i=2; i<=N; i++)
	{
		if(V.size()%2)
		{
			if(A[V.back()]<A[i]) V.push_back(i);
			else V.back()=i;
		}
		else
		{
			if(A[V.back()]>A[i]) V.push_back(i);
			else V.back()=i;
		}
	}
	if(V.size()%2==0) V.pop_back();

	set<int> S;
	set<pii> S2;
	for(int i=0; i<V.size(); i++)
	{
		S.insert(V[i]);
		if(i%2==0) B[V[i]]=1;
		else B[V[i]]=2;
	}
	for(int i=0; i+1<V.size(); i++) S2.insert({abs(A[V[i+1]]-A[V[i]]), V[i]});
	
	while(!S2.empty())
	{
		auto [val, p] = *S2.begin(); S2.erase(S2.begin());
		auto it=S.find(p);
		int l=-1, r=-1;

		if(it!=S.begin())
		{
			int t1=*prev(it), t2=*it;
			S2.erase({abs(A[t1]-A[t2]), t1});
			l=t1;
		}
		if(next(next(it))!=S.end())
		{
			int t1=*next(it), t2=*next(next(it));
			S2.erase({abs(A[t1]-A[t2]), t1});
			r=t2;
		}
		if(l!=-1 && r!=-1) S2.insert({abs(A[r]-A[l]), l});

		P[*next(it)]=val; P[*it]=val;
		S.erase(*next(it));
		S.erase(it);
	}

	for(int i=1; i<=N; i++) comp.push_back(P[i]);
	sort(comp.begin(), comp.end());
	comp.erase(unique(comp.begin(), comp.end()), comp.end());

	pst.tree[0]=pst.makeTree(1, comp.size());
	for(int i=1; i<=N; i++) 
	{
		pst.tree[i]=pst.addTree(pst.tree[i-1], 1, comp.size(), lower_bound(comp.begin(), comp.end(), P[i])-comp.begin()+1);
	}

	seg2.init(1, 1, N);
}

int max_towers(int L, int R, int D) 
{
	L++; R++;

	int t=lower_bound(comp.begin(), comp.end(), D)-comp.begin()+1;
	int ans=pst.query(pst.tree[R], 1, comp.size(), t, comp.size())-pst.query(pst.tree[L-1], 1, comp.size(), t, comp.size());
	
	if(!ans) return 1;

	int p=seg2.query1(1, 1, N, L, R, D), q=seg2.query2(1, 1, N, L, R, D);
	if(B[p]==2)
	{
		if(seg.query(1, 1, N, L, p-1)<=A[p]-D) ans++;
		else ans--;
	}
	if(B[q]==2)
	{
		if(seg.query(1, 1, N, q+1, R)<=A[q]-D) ans++;
		else ans--;
	}
	return ans/2+1;
}

Compilation message

towers.cpp: In member function 'void SEG::init(int, int, int)':
towers.cpp:25:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int SEG::query(int, int, int, int, int)':
towers.cpp:34:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'void SEG2::init(int, int, int)':
towers.cpp:49:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   49 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int SEG2::query1(int, int, int, int, int, int)':
towers.cpp:59:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   59 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int SEG2::query2(int, int, int, int, int, int)':
towers.cpp:70:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   70 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int PST::makeTree(int, int)':
towers.cpp:98:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   98 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int PST::addTree(int, int, int, int)':
towers.cpp:113:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  113 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In member function 'int PST::query(int, int, int, int, int)':
towers.cpp:124:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  124 |   int mid=tl+tr>>1;
      |           ~~^~~
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:154:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  154 |  for(int i=0; i<V.size(); i++)
      |               ~^~~~~~~~~
towers.cpp:160:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  160 |  for(int i=0; i+1<V.size(); i++) S2.insert({abs(A[V[i+1]]-A[V[i]]), V[i]});
      |               ~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 260 ms 4032 KB Output is correct
2 Correct 788 ms 6972 KB Output is correct
3 Correct 664 ms 7064 KB Output is correct
4 Correct 598 ms 5800 KB Output is correct
5 Correct 616 ms 5796 KB Output is correct
6 Correct 430 ms 7044 KB Output is correct
7 Correct 624 ms 5788 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 1004 KB Output is correct
3 Correct 2 ms 960 KB Output is correct
4 Correct 2 ms 960 KB Output is correct
5 Correct 2 ms 976 KB Output is correct
6 Correct 2 ms 960 KB Output is correct
7 Correct 2 ms 960 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 3 ms 960 KB Output is correct
16 Correct 2 ms 976 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 976 KB Output is correct
22 Correct 2 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
27 Correct 2 ms 960 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 976 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 2 ms 960 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 1004 KB Output is correct
3 Correct 2 ms 960 KB Output is correct
4 Correct 2 ms 960 KB Output is correct
5 Correct 2 ms 976 KB Output is correct
6 Correct 2 ms 960 KB Output is correct
7 Correct 2 ms 960 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 3 ms 960 KB Output is correct
16 Correct 2 ms 976 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 976 KB Output is correct
22 Correct 2 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
27 Correct 2 ms 960 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 976 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 2 ms 960 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 76 ms 29948 KB Output is correct
37 Correct 133 ms 33248 KB Output is correct
38 Correct 127 ms 32976 KB Output is correct
39 Correct 166 ms 36824 KB Output is correct
40 Correct 170 ms 36172 KB Output is correct
41 Correct 176 ms 37944 KB Output is correct
42 Correct 193 ms 34556 KB Output is correct
43 Correct 13 ms 5804 KB Output is correct
44 Correct 13 ms 5792 KB Output is correct
45 Correct 18 ms 9696 KB Output is correct
46 Correct 18 ms 9660 KB Output is correct
47 Correct 116 ms 34236 KB Output is correct
48 Correct 183 ms 37364 KB Output is correct
49 Correct 169 ms 36232 KB Output is correct
50 Correct 13 ms 5804 KB Output is correct
51 Correct 17 ms 9756 KB Output is correct
52 Correct 127 ms 32724 KB Output is correct
53 Correct 178 ms 37312 KB Output is correct
54 Correct 177 ms 34976 KB Output is correct
55 Correct 13 ms 5808 KB Output is correct
56 Correct 17 ms 9660 KB Output is correct
57 Correct 119 ms 33392 KB Output is correct
58 Correct 130 ms 34232 KB Output is correct
59 Correct 124 ms 34024 KB Output is correct
60 Correct 174 ms 36836 KB Output is correct
61 Correct 176 ms 33816 KB Output is correct
62 Correct 176 ms 37044 KB Output is correct
63 Correct 171 ms 37308 KB Output is correct
64 Correct 19 ms 5808 KB Output is correct
65 Correct 14 ms 5804 KB Output is correct
66 Correct 17 ms 9652 KB Output is correct
67 Correct 23 ms 9628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 716 ms 33988 KB Output is correct
2 Correct 946 ms 32076 KB Output is correct
3 Correct 893 ms 32496 KB Output is correct
4 Correct 1010 ms 37380 KB Output is correct
5 Correct 984 ms 37336 KB Output is correct
6 Correct 955 ms 37152 KB Output is correct
7 Correct 1091 ms 35640 KB Output is correct
8 Correct 623 ms 5800 KB Output is correct
9 Correct 730 ms 5796 KB Output is correct
10 Correct 727 ms 9744 KB Output is correct
11 Correct 921 ms 9740 KB Output is correct
12 Correct 704 ms 7060 KB Output is correct
13 Correct 539 ms 5816 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 127 ms 34460 KB Output is correct
18 Correct 185 ms 37424 KB Output is correct
19 Correct 168 ms 36224 KB Output is correct
20 Correct 13 ms 5824 KB Output is correct
21 Correct 17 ms 9660 KB Output is correct
22 Correct 122 ms 32732 KB Output is correct
23 Correct 170 ms 37252 KB Output is correct
24 Correct 175 ms 34892 KB Output is correct
25 Correct 18 ms 5776 KB Output is correct
26 Correct 17 ms 9628 KB Output is correct
27 Correct 2 ms 960 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 976 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 592 KB Output is correct
32 Correct 2 ms 976 KB Output is correct
33 Correct 2 ms 976 KB Output is correct
34 Correct 2 ms 976 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 8484 KB Output is correct
2 Correct 811 ms 33320 KB Output is correct
3 Correct 828 ms 32820 KB Output is correct
4 Correct 847 ms 37028 KB Output is correct
5 Correct 926 ms 36780 KB Output is correct
6 Correct 828 ms 36496 KB Output is correct
7 Correct 789 ms 37864 KB Output is correct
8 Correct 554 ms 5816 KB Output is correct
9 Correct 662 ms 5788 KB Output is correct
10 Correct 670 ms 9660 KB Output is correct
11 Correct 707 ms 9752 KB Output is correct
12 Correct 120 ms 32732 KB Output is correct
13 Correct 194 ms 37304 KB Output is correct
14 Correct 177 ms 34868 KB Output is correct
15 Correct 13 ms 5816 KB Output is correct
16 Correct 18 ms 9640 KB Output is correct
17 Correct 114 ms 33316 KB Output is correct
18 Correct 139 ms 34284 KB Output is correct
19 Correct 123 ms 33976 KB Output is correct
20 Correct 177 ms 36776 KB Output is correct
21 Correct 193 ms 33884 KB Output is correct
22 Correct 172 ms 37040 KB Output is correct
23 Correct 177 ms 37332 KB Output is correct
24 Correct 13 ms 5848 KB Output is correct
25 Correct 13 ms 5824 KB Output is correct
26 Correct 17 ms 9660 KB Output is correct
27 Correct 18 ms 9632 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 976 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 2 ms 960 KB Output is correct
35 Correct 2 ms 960 KB Output is correct
36 Correct 2 ms 952 KB Output is correct
37 Correct 2 ms 976 KB Output is correct
38 Correct 2 ms 976 KB Output is correct
39 Correct 2 ms 960 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 1 ms 336 KB Output is correct
42 Correct 1 ms 592 KB Output is correct
43 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 1004 KB Output is correct
3 Correct 2 ms 960 KB Output is correct
4 Correct 2 ms 960 KB Output is correct
5 Correct 2 ms 976 KB Output is correct
6 Correct 2 ms 960 KB Output is correct
7 Correct 2 ms 960 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 3 ms 960 KB Output is correct
16 Correct 2 ms 976 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 2 ms 976 KB Output is correct
21 Correct 2 ms 976 KB Output is correct
22 Correct 2 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 592 KB Output is correct
26 Correct 2 ms 960 KB Output is correct
27 Correct 2 ms 960 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 976 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 2 ms 960 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 76 ms 29948 KB Output is correct
37 Correct 133 ms 33248 KB Output is correct
38 Correct 127 ms 32976 KB Output is correct
39 Correct 166 ms 36824 KB Output is correct
40 Correct 170 ms 36172 KB Output is correct
41 Correct 176 ms 37944 KB Output is correct
42 Correct 193 ms 34556 KB Output is correct
43 Correct 13 ms 5804 KB Output is correct
44 Correct 13 ms 5792 KB Output is correct
45 Correct 18 ms 9696 KB Output is correct
46 Correct 18 ms 9660 KB Output is correct
47 Correct 116 ms 34236 KB Output is correct
48 Correct 183 ms 37364 KB Output is correct
49 Correct 169 ms 36232 KB Output is correct
50 Correct 13 ms 5804 KB Output is correct
51 Correct 17 ms 9756 KB Output is correct
52 Correct 127 ms 32724 KB Output is correct
53 Correct 178 ms 37312 KB Output is correct
54 Correct 177 ms 34976 KB Output is correct
55 Correct 13 ms 5808 KB Output is correct
56 Correct 17 ms 9660 KB Output is correct
57 Correct 119 ms 33392 KB Output is correct
58 Correct 130 ms 34232 KB Output is correct
59 Correct 124 ms 34024 KB Output is correct
60 Correct 174 ms 36836 KB Output is correct
61 Correct 176 ms 33816 KB Output is correct
62 Correct 176 ms 37044 KB Output is correct
63 Correct 171 ms 37308 KB Output is correct
64 Correct 19 ms 5808 KB Output is correct
65 Correct 14 ms 5804 KB Output is correct
66 Correct 17 ms 9652 KB Output is correct
67 Correct 23 ms 9628 KB Output is correct
68 Correct 716 ms 33988 KB Output is correct
69 Correct 946 ms 32076 KB Output is correct
70 Correct 893 ms 32496 KB Output is correct
71 Correct 1010 ms 37380 KB Output is correct
72 Correct 984 ms 37336 KB Output is correct
73 Correct 955 ms 37152 KB Output is correct
74 Correct 1091 ms 35640 KB Output is correct
75 Correct 623 ms 5800 KB Output is correct
76 Correct 730 ms 5796 KB Output is correct
77 Correct 727 ms 9744 KB Output is correct
78 Correct 921 ms 9740 KB Output is correct
79 Correct 704 ms 7060 KB Output is correct
80 Correct 539 ms 5816 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 1 ms 464 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 127 ms 34460 KB Output is correct
85 Correct 185 ms 37424 KB Output is correct
86 Correct 168 ms 36224 KB Output is correct
87 Correct 13 ms 5824 KB Output is correct
88 Correct 17 ms 9660 KB Output is correct
89 Correct 122 ms 32732 KB Output is correct
90 Correct 170 ms 37252 KB Output is correct
91 Correct 175 ms 34892 KB Output is correct
92 Correct 18 ms 5776 KB Output is correct
93 Correct 17 ms 9628 KB Output is correct
94 Correct 2 ms 960 KB Output is correct
95 Correct 2 ms 976 KB Output is correct
96 Correct 2 ms 976 KB Output is correct
97 Correct 1 ms 336 KB Output is correct
98 Correct 1 ms 592 KB Output is correct
99 Correct 2 ms 976 KB Output is correct
100 Correct 2 ms 976 KB Output is correct
101 Correct 2 ms 976 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 592 KB Output is correct
104 Correct 676 ms 33492 KB Output is correct
105 Correct 793 ms 32152 KB Output is correct
106 Correct 1020 ms 34004 KB Output is correct
107 Correct 1090 ms 34236 KB Output is correct
108 Correct 1056 ms 35364 KB Output is correct
109 Correct 927 ms 36944 KB Output is correct
110 Correct 1041 ms 36300 KB Output is correct
111 Correct 552 ms 5816 KB Output is correct
112 Correct 702 ms 5812 KB Output is correct
113 Correct 726 ms 9660 KB Output is correct
114 Correct 655 ms 9748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 260 ms 4032 KB Output is correct
2 Correct 788 ms 6972 KB Output is correct
3 Correct 664 ms 7064 KB Output is correct
4 Correct 598 ms 5800 KB Output is correct
5 Correct 616 ms 5796 KB Output is correct
6 Correct 430 ms 7044 KB Output is correct
7 Correct 624 ms 5788 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 1004 KB Output is correct
13 Correct 2 ms 960 KB Output is correct
14 Correct 2 ms 960 KB Output is correct
15 Correct 2 ms 976 KB Output is correct
16 Correct 2 ms 960 KB Output is correct
17 Correct 2 ms 960 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 592 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 3 ms 960 KB Output is correct
26 Correct 2 ms 976 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 592 KB Output is correct
30 Correct 2 ms 976 KB Output is correct
31 Correct 2 ms 976 KB Output is correct
32 Correct 2 ms 976 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 592 KB Output is correct
36 Correct 2 ms 960 KB Output is correct
37 Correct 2 ms 960 KB Output is correct
38 Correct 2 ms 976 KB Output is correct
39 Correct 2 ms 976 KB Output is correct
40 Correct 2 ms 976 KB Output is correct
41 Correct 2 ms 960 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 336 KB Output is correct
44 Correct 1 ms 592 KB Output is correct
45 Correct 1 ms 592 KB Output is correct
46 Correct 76 ms 29948 KB Output is correct
47 Correct 133 ms 33248 KB Output is correct
48 Correct 127 ms 32976 KB Output is correct
49 Correct 166 ms 36824 KB Output is correct
50 Correct 170 ms 36172 KB Output is correct
51 Correct 176 ms 37944 KB Output is correct
52 Correct 193 ms 34556 KB Output is correct
53 Correct 13 ms 5804 KB Output is correct
54 Correct 13 ms 5792 KB Output is correct
55 Correct 18 ms 9696 KB Output is correct
56 Correct 18 ms 9660 KB Output is correct
57 Correct 116 ms 34236 KB Output is correct
58 Correct 183 ms 37364 KB Output is correct
59 Correct 169 ms 36232 KB Output is correct
60 Correct 13 ms 5804 KB Output is correct
61 Correct 17 ms 9756 KB Output is correct
62 Correct 127 ms 32724 KB Output is correct
63 Correct 178 ms 37312 KB Output is correct
64 Correct 177 ms 34976 KB Output is correct
65 Correct 13 ms 5808 KB Output is correct
66 Correct 17 ms 9660 KB Output is correct
67 Correct 119 ms 33392 KB Output is correct
68 Correct 130 ms 34232 KB Output is correct
69 Correct 124 ms 34024 KB Output is correct
70 Correct 174 ms 36836 KB Output is correct
71 Correct 176 ms 33816 KB Output is correct
72 Correct 176 ms 37044 KB Output is correct
73 Correct 171 ms 37308 KB Output is correct
74 Correct 19 ms 5808 KB Output is correct
75 Correct 14 ms 5804 KB Output is correct
76 Correct 17 ms 9652 KB Output is correct
77 Correct 23 ms 9628 KB Output is correct
78 Correct 716 ms 33988 KB Output is correct
79 Correct 946 ms 32076 KB Output is correct
80 Correct 893 ms 32496 KB Output is correct
81 Correct 1010 ms 37380 KB Output is correct
82 Correct 984 ms 37336 KB Output is correct
83 Correct 955 ms 37152 KB Output is correct
84 Correct 1091 ms 35640 KB Output is correct
85 Correct 623 ms 5800 KB Output is correct
86 Correct 730 ms 5796 KB Output is correct
87 Correct 727 ms 9744 KB Output is correct
88 Correct 921 ms 9740 KB Output is correct
89 Correct 704 ms 7060 KB Output is correct
90 Correct 539 ms 5816 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 1 ms 464 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 127 ms 34460 KB Output is correct
95 Correct 185 ms 37424 KB Output is correct
96 Correct 168 ms 36224 KB Output is correct
97 Correct 13 ms 5824 KB Output is correct
98 Correct 17 ms 9660 KB Output is correct
99 Correct 122 ms 32732 KB Output is correct
100 Correct 170 ms 37252 KB Output is correct
101 Correct 175 ms 34892 KB Output is correct
102 Correct 18 ms 5776 KB Output is correct
103 Correct 17 ms 9628 KB Output is correct
104 Correct 2 ms 960 KB Output is correct
105 Correct 2 ms 976 KB Output is correct
106 Correct 2 ms 976 KB Output is correct
107 Correct 1 ms 336 KB Output is correct
108 Correct 1 ms 592 KB Output is correct
109 Correct 2 ms 976 KB Output is correct
110 Correct 2 ms 976 KB Output is correct
111 Correct 2 ms 976 KB Output is correct
112 Correct 1 ms 336 KB Output is correct
113 Correct 1 ms 592 KB Output is correct
114 Correct 246 ms 8484 KB Output is correct
115 Correct 811 ms 33320 KB Output is correct
116 Correct 828 ms 32820 KB Output is correct
117 Correct 847 ms 37028 KB Output is correct
118 Correct 926 ms 36780 KB Output is correct
119 Correct 828 ms 36496 KB Output is correct
120 Correct 789 ms 37864 KB Output is correct
121 Correct 554 ms 5816 KB Output is correct
122 Correct 662 ms 5788 KB Output is correct
123 Correct 670 ms 9660 KB Output is correct
124 Correct 707 ms 9752 KB Output is correct
125 Correct 120 ms 32732 KB Output is correct
126 Correct 194 ms 37304 KB Output is correct
127 Correct 177 ms 34868 KB Output is correct
128 Correct 13 ms 5816 KB Output is correct
129 Correct 18 ms 9640 KB Output is correct
130 Correct 114 ms 33316 KB Output is correct
131 Correct 139 ms 34284 KB Output is correct
132 Correct 123 ms 33976 KB Output is correct
133 Correct 177 ms 36776 KB Output is correct
134 Correct 193 ms 33884 KB Output is correct
135 Correct 172 ms 37040 KB Output is correct
136 Correct 177 ms 37332 KB Output is correct
137 Correct 13 ms 5848 KB Output is correct
138 Correct 13 ms 5824 KB Output is correct
139 Correct 17 ms 9660 KB Output is correct
140 Correct 18 ms 9632 KB Output is correct
141 Correct 2 ms 976 KB Output is correct
142 Correct 2 ms 976 KB Output is correct
143 Correct 2 ms 976 KB Output is correct
144 Correct 1 ms 336 KB Output is correct
145 Correct 1 ms 592 KB Output is correct
146 Correct 1 ms 592 KB Output is correct
147 Correct 2 ms 960 KB Output is correct
148 Correct 2 ms 960 KB Output is correct
149 Correct 2 ms 952 KB Output is correct
150 Correct 2 ms 976 KB Output is correct
151 Correct 2 ms 976 KB Output is correct
152 Correct 2 ms 960 KB Output is correct
153 Correct 1 ms 336 KB Output is correct
154 Correct 1 ms 336 KB Output is correct
155 Correct 1 ms 592 KB Output is correct
156 Correct 1 ms 512 KB Output is correct
157 Correct 676 ms 33492 KB Output is correct
158 Correct 793 ms 32152 KB Output is correct
159 Correct 1020 ms 34004 KB Output is correct
160 Correct 1090 ms 34236 KB Output is correct
161 Correct 1056 ms 35364 KB Output is correct
162 Correct 927 ms 36944 KB Output is correct
163 Correct 1041 ms 36300 KB Output is correct
164 Correct 552 ms 5816 KB Output is correct
165 Correct 702 ms 5812 KB Output is correct
166 Correct 726 ms 9660 KB Output is correct
167 Correct 655 ms 9748 KB Output is correct
168 Correct 1 ms 336 KB Output is correct
169 Correct 545 ms 15976 KB Output is correct
170 Correct 1070 ms 33704 KB Output is correct
171 Correct 1063 ms 33412 KB Output is correct
172 Correct 1060 ms 37892 KB Output is correct
173 Correct 1062 ms 37468 KB Output is correct
174 Correct 1100 ms 36316 KB Output is correct
175 Correct 1028 ms 36388 KB Output is correct
176 Correct 539 ms 5824 KB Output is correct
177 Correct 523 ms 5812 KB Output is correct
178 Correct 718 ms 9728 KB Output is correct
179 Correct 766 ms 9652 KB Output is correct