답안 #568033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568033 2022-05-24T14:12:31 Z MohamedAhmed04 Interval Collection (CCO20_day2problem2) C++14
22 / 25
7000 ms 281884 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 1e6 + 10 ;

int tree[2][2 * MAX + 100] ;
int val[2][MAX] ;

int tmp[2] = {(int)1e9 , (int)-1e9} ;

void build(bool t)
{
	for(int i = 2*MAX ; i >= 0 ; --i)
		tree[t][i] = tmp[t] ;
}

void update(int idx , int val , bool t)
{
	for(tree[t][idx += MAX] = val ; idx > 1 ; idx >>= 1)
	{
		if(!t)
			tree[t][idx >> 1] = min(tree[t][idx] , tree[t][idx^1]) ;
		else
			tree[t][idx >> 1] = max(tree[t][idx] , tree[t][idx^1]) ;
	}
}

int query(int l , int r , bool t)
{
	++r ;
	int ans = tmp[t] ;
	for(l += MAX , r += MAX ; l < r ; l >>= 1 , r >>= 1)
	{
		if(l & 1)
		{
			if(!t)
				ans = min(ans , tree[t][l++]) ;
			else
				ans = max(ans , tree[t][l++]) ;
		}
		if(r & 1)
		{
			if(!t)
				ans = min(ans , tree[t][--r]) ;
			else
				ans = max(ans , tree[t][--r]) ;
		}
	}
	return ans ;
}

int q ;

set<int>sl[MAX] , sr[MAX] ;

pair<int , int>calc(int l , int r)
{
	pair<int , int>p = {r-l , r-l} ;
	if(tree[0][1] <= l)
	{
		int x = query(1 , l , 1) ;
		p = min(p , make_pair(0 , r - x)) ;
	}
	if(tree[1][1] >= r)
	{
		int x = query(r , MAX , 0) ;
		p = min(p , make_pair(0 , x - l)) ;
	}
	if(p.first)
	{
		int x = val[1][tree[0][1]] ;
		p = min(p , make_pair(tree[0][1] - l , r - x)) ;

		x = val[0][tree[1][1]] ;
		p = min(p , make_pair(r - tree[1][1] , x - l)) ;
	}
	return p ;
}

char c[MAX] ;
int L[MAX] , R[MAX] , id[MAX] ;
int ans[MAX] ;

vector< pair<int , int> >tree2[2 * MAX] ;

void Add(int node , int l , int r , int from , int to)
{
	if(from > r || to < l)
		return ;
	if(l >= from && r <= to)
	{
		tree2[node].emplace_back(L[from] , R[from]) ;
		return ;
	}
	int mid = (l + r) >> 1 ;
	Add(node << 1 , l , mid , from , to) ;
	Add(node << 1 | 1 , mid+1 , r , from , to) ;
}

void solve(int node , int st , int en , pair<int , int>best)
{
	if(st > en)
		return ;
	pair<int , int>best2 = best ;
	for(auto &p : tree2[node])
	{
		int l = p.first , r = p.second ;
		sl[l].insert(r) ;
		sr[r].insert(l) ;
		int x = val[0][l] , y = val[1][r] ;
		val[0][l] = *sl[l].begin() , val[1][r] = *sr[r].rbegin() ;
		if(x != val[0][l])
			update(l , val[0][l] , 0) ;
		if(y != val[1][r]) 
			update(r , val[1][r] , 1) ;
		best2 = min(best2 , calc(l , r)) ;
	}
	int mid = (st + en) >> 1 ;
	if(st == en)
		ans[st] = best2.second ;
	else
		solve(node << 1 , st , mid , best2) , solve(node << 1 | 1 , mid+1 , en , best2) ;
	for(auto &p : tree2[node])
	{
		int l = p.first , r = p.second ;
		sl[l].erase(r) ;
		sr[r].erase(l) ;
		int x = val[0][l] , y = val[1][r] ;
		val[0][l] = tmp[0] ;
		if(sl[l].size())
			val[0][l] = *sl[l].begin() ;
		val[1][r] = tmp[1] ;
		if(sr[r].size())
			val[1][r] = *sr[r].rbegin() ;
		if(x != val[0][l])
			update(l , val[0][l] , 0) ;
		if(y != val[1][r])
			update(r , val[1][r] , 1) ;
	}
}

void pre_id()
{
	vector< pair<int , int> >vp ;
	for(int i = 1 ; i <= q ; ++i)
		vp.emplace_back(L[i] , R[i]) ;
	sort(vp.begin() , vp.end()) ;
	vp.erase(unique(vp.begin() , vp.end()) , vp.end()) ;
	for(int i = 1 ; i <= q ; ++i)
	{
		id[i] = lower_bound(vp.begin() , vp.end() , make_pair(L[i] , R[i])) - vp.begin() ;
		id[i]++ ;
	}
}

int freq[MAX] , prv[MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	build(0) , build(1) ;
	cin>>q ;
	for(int i = 1 ; i <= q ; ++i)
		cin>>c[i]>>L[i]>>R[i] ;
	pre_id() ;
	for(int i = 1 ; i <= q ; ++i)
	{
		if(c[i] == 'A')
		{
			if(!freq[id[i]])
				prv[id[i]] = i ;
			freq[id[i]]++ ;
		}
		else if(c[i] == 'R')
		{
			freq[id[i]]-- ;
			if(!freq[id[i]])
				Add(1 , 1 , q , prv[id[i]] , i-1) ;
		}
	}
	for(int i = 1 ; i <= q ; ++i)
	{
		if(freq[id[i]])
		{
			Add(1 , 1 , q , prv[id[i]] , q) ;
			freq[id[i]] = 0 ;
		}
	}
	solve(1 , 1 , q , {2e9 , 2e9}) ;
	for(int i = 1 ; i <= q ; ++i)
		cout<<ans[i]<<"\n" ;
	return 0 ;
}		
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 159064 KB Output is correct
2 Correct 94 ms 158604 KB Output is correct
3 Correct 76 ms 158620 KB Output is correct
4 Correct 76 ms 158484 KB Output is correct
5 Correct 78 ms 159164 KB Output is correct
6 Correct 85 ms 158752 KB Output is correct
7 Correct 78 ms 158540 KB Output is correct
8 Correct 77 ms 158640 KB Output is correct
9 Correct 78 ms 159416 KB Output is correct
10 Correct 89 ms 159260 KB Output is correct
11 Correct 78 ms 159128 KB Output is correct
12 Correct 78 ms 159156 KB Output is correct
13 Correct 80 ms 159616 KB Output is correct
14 Correct 83 ms 159612 KB Output is correct
15 Correct 81 ms 159628 KB Output is correct
16 Correct 78 ms 159524 KB Output is correct
17 Correct 78 ms 158924 KB Output is correct
18 Correct 81 ms 158540 KB Output is correct
19 Correct 79 ms 158436 KB Output is correct
20 Correct 80 ms 158600 KB Output is correct
21 Correct 78 ms 158884 KB Output is correct
22 Correct 79 ms 158584 KB Output is correct
23 Correct 77 ms 158384 KB Output is correct
24 Correct 81 ms 158520 KB Output is correct
25 Correct 81 ms 159356 KB Output is correct
26 Correct 81 ms 159140 KB Output is correct
27 Correct 80 ms 159088 KB Output is correct
28 Correct 80 ms 158940 KB Output is correct
29 Correct 80 ms 159436 KB Output is correct
30 Correct 83 ms 159360 KB Output is correct
31 Correct 82 ms 159564 KB Output is correct
32 Correct 91 ms 159460 KB Output is correct
33 Correct 85 ms 158528 KB Output is correct
34 Correct 78 ms 158600 KB Output is correct
35 Correct 78 ms 158548 KB Output is correct
36 Correct 80 ms 158560 KB Output is correct
37 Correct 81 ms 158612 KB Output is correct
38 Correct 75 ms 158528 KB Output is correct
39 Correct 80 ms 158500 KB Output is correct
40 Correct 92 ms 158592 KB Output is correct
41 Correct 76 ms 158968 KB Output is correct
42 Correct 77 ms 158532 KB Output is correct
43 Correct 77 ms 158540 KB Output is correct
44 Correct 75 ms 158484 KB Output is correct
45 Correct 84 ms 158620 KB Output is correct
46 Correct 78 ms 158460 KB Output is correct
47 Correct 75 ms 158540 KB Output is correct
48 Correct 77 ms 158504 KB Output is correct
49 Correct 74 ms 157412 KB Output is correct
50 Correct 84 ms 157424 KB Output is correct
51 Correct 77 ms 157516 KB Output is correct
52 Correct 85 ms 157396 KB Output is correct
53 Correct 85 ms 157476 KB Output is correct
54 Correct 77 ms 157424 KB Output is correct
55 Correct 80 ms 157420 KB Output is correct
56 Correct 77 ms 157440 KB Output is correct
57 Correct 77 ms 157424 KB Output is correct
58 Correct 82 ms 157444 KB Output is correct
59 Correct 81 ms 157928 KB Output is correct
60 Correct 77 ms 157984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 159064 KB Output is correct
2 Correct 94 ms 158604 KB Output is correct
3 Correct 76 ms 158620 KB Output is correct
4 Correct 76 ms 158484 KB Output is correct
5 Correct 78 ms 159164 KB Output is correct
6 Correct 85 ms 158752 KB Output is correct
7 Correct 78 ms 158540 KB Output is correct
8 Correct 77 ms 158640 KB Output is correct
9 Correct 78 ms 159416 KB Output is correct
10 Correct 89 ms 159260 KB Output is correct
11 Correct 78 ms 159128 KB Output is correct
12 Correct 78 ms 159156 KB Output is correct
13 Correct 80 ms 159616 KB Output is correct
14 Correct 83 ms 159612 KB Output is correct
15 Correct 81 ms 159628 KB Output is correct
16 Correct 78 ms 159524 KB Output is correct
17 Correct 78 ms 158924 KB Output is correct
18 Correct 81 ms 158540 KB Output is correct
19 Correct 79 ms 158436 KB Output is correct
20 Correct 80 ms 158600 KB Output is correct
21 Correct 78 ms 158884 KB Output is correct
22 Correct 79 ms 158584 KB Output is correct
23 Correct 77 ms 158384 KB Output is correct
24 Correct 81 ms 158520 KB Output is correct
25 Correct 81 ms 159356 KB Output is correct
26 Correct 81 ms 159140 KB Output is correct
27 Correct 80 ms 159088 KB Output is correct
28 Correct 80 ms 158940 KB Output is correct
29 Correct 80 ms 159436 KB Output is correct
30 Correct 83 ms 159360 KB Output is correct
31 Correct 82 ms 159564 KB Output is correct
32 Correct 91 ms 159460 KB Output is correct
33 Correct 85 ms 158528 KB Output is correct
34 Correct 78 ms 158600 KB Output is correct
35 Correct 78 ms 158548 KB Output is correct
36 Correct 80 ms 158560 KB Output is correct
37 Correct 81 ms 158612 KB Output is correct
38 Correct 75 ms 158528 KB Output is correct
39 Correct 80 ms 158500 KB Output is correct
40 Correct 92 ms 158592 KB Output is correct
41 Correct 76 ms 158968 KB Output is correct
42 Correct 77 ms 158532 KB Output is correct
43 Correct 77 ms 158540 KB Output is correct
44 Correct 75 ms 158484 KB Output is correct
45 Correct 84 ms 158620 KB Output is correct
46 Correct 78 ms 158460 KB Output is correct
47 Correct 75 ms 158540 KB Output is correct
48 Correct 77 ms 158504 KB Output is correct
49 Correct 74 ms 157412 KB Output is correct
50 Correct 84 ms 157424 KB Output is correct
51 Correct 77 ms 157516 KB Output is correct
52 Correct 85 ms 157396 KB Output is correct
53 Correct 85 ms 157476 KB Output is correct
54 Correct 77 ms 157424 KB Output is correct
55 Correct 80 ms 157420 KB Output is correct
56 Correct 77 ms 157440 KB Output is correct
57 Correct 77 ms 157424 KB Output is correct
58 Correct 82 ms 157444 KB Output is correct
59 Correct 81 ms 157928 KB Output is correct
60 Correct 77 ms 157984 KB Output is correct
61 Correct 77 ms 156880 KB Output is correct
62 Correct 82 ms 156896 KB Output is correct
63 Correct 88 ms 156944 KB Output is correct
64 Correct 159 ms 165984 KB Output is correct
65 Correct 134 ms 165392 KB Output is correct
66 Correct 120 ms 164904 KB Output is correct
67 Correct 92 ms 164504 KB Output is correct
68 Correct 173 ms 166060 KB Output is correct
69 Correct 142 ms 165292 KB Output is correct
70 Correct 118 ms 164968 KB Output is correct
71 Correct 112 ms 164728 KB Output is correct
72 Correct 160 ms 166640 KB Output is correct
73 Correct 160 ms 166396 KB Output is correct
74 Correct 169 ms 166288 KB Output is correct
75 Correct 150 ms 166240 KB Output is correct
76 Correct 164 ms 166792 KB Output is correct
77 Correct 185 ms 166808 KB Output is correct
78 Correct 162 ms 166772 KB Output is correct
79 Correct 163 ms 166864 KB Output is correct
80 Correct 160 ms 166536 KB Output is correct
81 Correct 132 ms 165836 KB Output is correct
82 Correct 131 ms 165436 KB Output is correct
83 Correct 91 ms 164504 KB Output is correct
84 Correct 147 ms 166508 KB Output is correct
85 Correct 130 ms 165756 KB Output is correct
86 Correct 117 ms 165508 KB Output is correct
87 Correct 111 ms 165376 KB Output is correct
88 Correct 192 ms 166900 KB Output is correct
89 Correct 147 ms 166776 KB Output is correct
90 Correct 149 ms 167024 KB Output is correct
91 Correct 147 ms 166732 KB Output is correct
92 Correct 168 ms 167280 KB Output is correct
93 Correct 162 ms 167360 KB Output is correct
94 Correct 163 ms 167248 KB Output is correct
95 Correct 162 ms 167248 KB Output is correct
96 Correct 98 ms 164384 KB Output is correct
97 Correct 94 ms 164480 KB Output is correct
98 Correct 92 ms 164372 KB Output is correct
99 Correct 93 ms 164424 KB Output is correct
100 Correct 111 ms 164800 KB Output is correct
101 Correct 103 ms 164576 KB Output is correct
102 Correct 113 ms 164808 KB Output is correct
103 Correct 91 ms 164436 KB Output is correct
104 Correct 143 ms 165936 KB Output is correct
105 Correct 126 ms 165244 KB Output is correct
106 Correct 115 ms 164836 KB Output is correct
107 Correct 93 ms 164420 KB Output is correct
108 Correct 146 ms 165660 KB Output is correct
109 Correct 131 ms 165080 KB Output is correct
110 Correct 111 ms 164852 KB Output is correct
111 Correct 93 ms 164480 KB Output is correct
112 Correct 104 ms 162424 KB Output is correct
113 Correct 108 ms 162496 KB Output is correct
114 Correct 100 ms 162468 KB Output is correct
115 Correct 107 ms 162460 KB Output is correct
116 Correct 104 ms 162360 KB Output is correct
117 Correct 104 ms 162416 KB Output is correct
118 Correct 111 ms 162364 KB Output is correct
119 Correct 105 ms 162456 KB Output is correct
120 Correct 100 ms 162460 KB Output is correct
121 Correct 106 ms 162496 KB Output is correct
122 Correct 133 ms 167380 KB Output is correct
123 Correct 126 ms 167288 KB Output is correct
124 Correct 115 ms 158820 KB Output is correct
125 Correct 102 ms 158384 KB Output is correct
126 Correct 100 ms 158176 KB Output is correct
127 Correct 116 ms 158892 KB Output is correct
128 Correct 103 ms 158200 KB Output is correct
129 Correct 102 ms 158316 KB Output is correct
130 Correct 118 ms 158996 KB Output is correct
131 Correct 102 ms 158204 KB Output is correct
132 Correct 103 ms 158328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 159064 KB Output is correct
2 Correct 94 ms 158604 KB Output is correct
3 Correct 76 ms 158620 KB Output is correct
4 Correct 76 ms 158484 KB Output is correct
5 Correct 78 ms 159164 KB Output is correct
6 Correct 85 ms 158752 KB Output is correct
7 Correct 78 ms 158540 KB Output is correct
8 Correct 77 ms 158640 KB Output is correct
9 Correct 78 ms 159416 KB Output is correct
10 Correct 89 ms 159260 KB Output is correct
11 Correct 78 ms 159128 KB Output is correct
12 Correct 78 ms 159156 KB Output is correct
13 Correct 80 ms 159616 KB Output is correct
14 Correct 83 ms 159612 KB Output is correct
15 Correct 81 ms 159628 KB Output is correct
16 Correct 78 ms 159524 KB Output is correct
17 Correct 78 ms 158924 KB Output is correct
18 Correct 81 ms 158540 KB Output is correct
19 Correct 79 ms 158436 KB Output is correct
20 Correct 80 ms 158600 KB Output is correct
21 Correct 78 ms 158884 KB Output is correct
22 Correct 79 ms 158584 KB Output is correct
23 Correct 77 ms 158384 KB Output is correct
24 Correct 81 ms 158520 KB Output is correct
25 Correct 81 ms 159356 KB Output is correct
26 Correct 81 ms 159140 KB Output is correct
27 Correct 80 ms 159088 KB Output is correct
28 Correct 80 ms 158940 KB Output is correct
29 Correct 80 ms 159436 KB Output is correct
30 Correct 83 ms 159360 KB Output is correct
31 Correct 82 ms 159564 KB Output is correct
32 Correct 91 ms 159460 KB Output is correct
33 Correct 85 ms 158528 KB Output is correct
34 Correct 78 ms 158600 KB Output is correct
35 Correct 78 ms 158548 KB Output is correct
36 Correct 80 ms 158560 KB Output is correct
37 Correct 81 ms 158612 KB Output is correct
38 Correct 75 ms 158528 KB Output is correct
39 Correct 80 ms 158500 KB Output is correct
40 Correct 92 ms 158592 KB Output is correct
41 Correct 76 ms 158968 KB Output is correct
42 Correct 77 ms 158532 KB Output is correct
43 Correct 77 ms 158540 KB Output is correct
44 Correct 75 ms 158484 KB Output is correct
45 Correct 84 ms 158620 KB Output is correct
46 Correct 78 ms 158460 KB Output is correct
47 Correct 75 ms 158540 KB Output is correct
48 Correct 77 ms 158504 KB Output is correct
49 Correct 74 ms 157412 KB Output is correct
50 Correct 84 ms 157424 KB Output is correct
51 Correct 77 ms 157516 KB Output is correct
52 Correct 85 ms 157396 KB Output is correct
53 Correct 85 ms 157476 KB Output is correct
54 Correct 77 ms 157424 KB Output is correct
55 Correct 80 ms 157420 KB Output is correct
56 Correct 77 ms 157440 KB Output is correct
57 Correct 77 ms 157424 KB Output is correct
58 Correct 82 ms 157444 KB Output is correct
59 Correct 81 ms 157928 KB Output is correct
60 Correct 77 ms 157984 KB Output is correct
61 Correct 77 ms 156880 KB Output is correct
62 Correct 82 ms 156896 KB Output is correct
63 Correct 88 ms 156944 KB Output is correct
64 Correct 159 ms 165984 KB Output is correct
65 Correct 134 ms 165392 KB Output is correct
66 Correct 120 ms 164904 KB Output is correct
67 Correct 92 ms 164504 KB Output is correct
68 Correct 173 ms 166060 KB Output is correct
69 Correct 142 ms 165292 KB Output is correct
70 Correct 118 ms 164968 KB Output is correct
71 Correct 112 ms 164728 KB Output is correct
72 Correct 160 ms 166640 KB Output is correct
73 Correct 160 ms 166396 KB Output is correct
74 Correct 169 ms 166288 KB Output is correct
75 Correct 150 ms 166240 KB Output is correct
76 Correct 164 ms 166792 KB Output is correct
77 Correct 185 ms 166808 KB Output is correct
78 Correct 162 ms 166772 KB Output is correct
79 Correct 163 ms 166864 KB Output is correct
80 Correct 160 ms 166536 KB Output is correct
81 Correct 132 ms 165836 KB Output is correct
82 Correct 131 ms 165436 KB Output is correct
83 Correct 91 ms 164504 KB Output is correct
84 Correct 147 ms 166508 KB Output is correct
85 Correct 130 ms 165756 KB Output is correct
86 Correct 117 ms 165508 KB Output is correct
87 Correct 111 ms 165376 KB Output is correct
88 Correct 192 ms 166900 KB Output is correct
89 Correct 147 ms 166776 KB Output is correct
90 Correct 149 ms 167024 KB Output is correct
91 Correct 147 ms 166732 KB Output is correct
92 Correct 168 ms 167280 KB Output is correct
93 Correct 162 ms 167360 KB Output is correct
94 Correct 163 ms 167248 KB Output is correct
95 Correct 162 ms 167248 KB Output is correct
96 Correct 98 ms 164384 KB Output is correct
97 Correct 94 ms 164480 KB Output is correct
98 Correct 92 ms 164372 KB Output is correct
99 Correct 93 ms 164424 KB Output is correct
100 Correct 111 ms 164800 KB Output is correct
101 Correct 103 ms 164576 KB Output is correct
102 Correct 113 ms 164808 KB Output is correct
103 Correct 91 ms 164436 KB Output is correct
104 Correct 143 ms 165936 KB Output is correct
105 Correct 126 ms 165244 KB Output is correct
106 Correct 115 ms 164836 KB Output is correct
107 Correct 93 ms 164420 KB Output is correct
108 Correct 146 ms 165660 KB Output is correct
109 Correct 131 ms 165080 KB Output is correct
110 Correct 111 ms 164852 KB Output is correct
111 Correct 93 ms 164480 KB Output is correct
112 Correct 104 ms 162424 KB Output is correct
113 Correct 108 ms 162496 KB Output is correct
114 Correct 100 ms 162468 KB Output is correct
115 Correct 107 ms 162460 KB Output is correct
116 Correct 104 ms 162360 KB Output is correct
117 Correct 104 ms 162416 KB Output is correct
118 Correct 111 ms 162364 KB Output is correct
119 Correct 105 ms 162456 KB Output is correct
120 Correct 100 ms 162460 KB Output is correct
121 Correct 106 ms 162496 KB Output is correct
122 Correct 133 ms 167380 KB Output is correct
123 Correct 126 ms 167288 KB Output is correct
124 Correct 115 ms 158820 KB Output is correct
125 Correct 102 ms 158384 KB Output is correct
126 Correct 100 ms 158176 KB Output is correct
127 Correct 116 ms 158892 KB Output is correct
128 Correct 103 ms 158200 KB Output is correct
129 Correct 102 ms 158316 KB Output is correct
130 Correct 118 ms 158996 KB Output is correct
131 Correct 102 ms 158204 KB Output is correct
132 Correct 103 ms 158328 KB Output is correct
133 Correct 480 ms 173804 KB Output is correct
134 Correct 388 ms 171632 KB Output is correct
135 Correct 290 ms 170632 KB Output is correct
136 Correct 146 ms 168580 KB Output is correct
137 Correct 484 ms 173784 KB Output is correct
138 Correct 389 ms 171500 KB Output is correct
139 Correct 323 ms 170436 KB Output is correct
140 Correct 228 ms 169648 KB Output is correct
141 Correct 508 ms 175464 KB Output is correct
142 Correct 489 ms 174876 KB Output is correct
143 Correct 459 ms 174700 KB Output is correct
144 Correct 451 ms 174516 KB Output is correct
145 Correct 513 ms 176156 KB Output is correct
146 Correct 505 ms 176268 KB Output is correct
147 Correct 506 ms 176360 KB Output is correct
148 Correct 499 ms 176168 KB Output is correct
149 Correct 471 ms 174064 KB Output is correct
150 Correct 372 ms 171936 KB Output is correct
151 Correct 287 ms 170964 KB Output is correct
152 Correct 142 ms 168752 KB Output is correct
153 Correct 492 ms 173856 KB Output is correct
154 Correct 378 ms 171700 KB Output is correct
155 Correct 278 ms 170652 KB Output is correct
156 Correct 220 ms 169776 KB Output is correct
157 Correct 516 ms 175592 KB Output is correct
158 Correct 453 ms 174916 KB Output is correct
159 Correct 466 ms 174800 KB Output is correct
160 Correct 444 ms 174776 KB Output is correct
161 Correct 531 ms 176316 KB Output is correct
162 Correct 500 ms 176320 KB Output is correct
163 Correct 492 ms 176312 KB Output is correct
164 Correct 502 ms 176372 KB Output is correct
165 Correct 131 ms 167868 KB Output is correct
166 Correct 132 ms 167900 KB Output is correct
167 Correct 129 ms 167960 KB Output is correct
168 Correct 133 ms 167868 KB Output is correct
169 Correct 245 ms 169684 KB Output is correct
170 Correct 199 ms 169272 KB Output is correct
171 Correct 188 ms 169152 KB Output is correct
172 Correct 147 ms 168244 KB Output is correct
173 Correct 462 ms 174008 KB Output is correct
174 Correct 353 ms 171348 KB Output is correct
175 Correct 261 ms 169992 KB Output is correct
176 Correct 146 ms 168148 KB Output is correct
177 Correct 463 ms 173460 KB Output is correct
178 Correct 368 ms 170968 KB Output is correct
179 Correct 272 ms 169956 KB Output is correct
180 Correct 160 ms 168268 KB Output is correct
181 Correct 191 ms 168632 KB Output is correct
182 Correct 231 ms 168584 KB Output is correct
183 Correct 194 ms 168252 KB Output is correct
184 Correct 223 ms 168296 KB Output is correct
185 Correct 190 ms 168648 KB Output is correct
186 Correct 237 ms 168752 KB Output is correct
187 Correct 187 ms 168320 KB Output is correct
188 Correct 227 ms 168248 KB Output is correct
189 Correct 200 ms 168564 KB Output is correct
190 Correct 232 ms 168628 KB Output is correct
191 Correct 300 ms 176152 KB Output is correct
192 Correct 284 ms 176072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 944 ms 211788 KB Output is correct
2 Correct 922 ms 211780 KB Output is correct
3 Correct 1715 ms 260556 KB Output is correct
4 Correct 1721 ms 260428 KB Output is correct
5 Correct 2105 ms 280768 KB Output is correct
6 Correct 2163 ms 280972 KB Output is correct
7 Correct 2661 ms 222460 KB Output is correct
8 Correct 1865 ms 215396 KB Output is correct
9 Correct 1783 ms 214108 KB Output is correct
10 Correct 2949 ms 226664 KB Output is correct
11 Correct 1902 ms 215488 KB Output is correct
12 Correct 1762 ms 214244 KB Output is correct
13 Correct 3115 ms 228436 KB Output is correct
14 Correct 1840 ms 215680 KB Output is correct
15 Correct 1750 ms 214032 KB Output is correct
16 Correct 1103 ms 206744 KB Output is correct
17 Correct 1098 ms 206520 KB Output is correct
18 Correct 1116 ms 206216 KB Output is correct
19 Correct 1137 ms 206780 KB Output is correct
20 Correct 1108 ms 206432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 159064 KB Output is correct
2 Correct 94 ms 158604 KB Output is correct
3 Correct 76 ms 158620 KB Output is correct
4 Correct 76 ms 158484 KB Output is correct
5 Correct 78 ms 159164 KB Output is correct
6 Correct 85 ms 158752 KB Output is correct
7 Correct 78 ms 158540 KB Output is correct
8 Correct 77 ms 158640 KB Output is correct
9 Correct 78 ms 159416 KB Output is correct
10 Correct 89 ms 159260 KB Output is correct
11 Correct 78 ms 159128 KB Output is correct
12 Correct 78 ms 159156 KB Output is correct
13 Correct 80 ms 159616 KB Output is correct
14 Correct 83 ms 159612 KB Output is correct
15 Correct 81 ms 159628 KB Output is correct
16 Correct 78 ms 159524 KB Output is correct
17 Correct 78 ms 158924 KB Output is correct
18 Correct 81 ms 158540 KB Output is correct
19 Correct 79 ms 158436 KB Output is correct
20 Correct 80 ms 158600 KB Output is correct
21 Correct 78 ms 158884 KB Output is correct
22 Correct 79 ms 158584 KB Output is correct
23 Correct 77 ms 158384 KB Output is correct
24 Correct 81 ms 158520 KB Output is correct
25 Correct 81 ms 159356 KB Output is correct
26 Correct 81 ms 159140 KB Output is correct
27 Correct 80 ms 159088 KB Output is correct
28 Correct 80 ms 158940 KB Output is correct
29 Correct 80 ms 159436 KB Output is correct
30 Correct 83 ms 159360 KB Output is correct
31 Correct 82 ms 159564 KB Output is correct
32 Correct 91 ms 159460 KB Output is correct
33 Correct 85 ms 158528 KB Output is correct
34 Correct 78 ms 158600 KB Output is correct
35 Correct 78 ms 158548 KB Output is correct
36 Correct 80 ms 158560 KB Output is correct
37 Correct 81 ms 158612 KB Output is correct
38 Correct 75 ms 158528 KB Output is correct
39 Correct 80 ms 158500 KB Output is correct
40 Correct 92 ms 158592 KB Output is correct
41 Correct 76 ms 158968 KB Output is correct
42 Correct 77 ms 158532 KB Output is correct
43 Correct 77 ms 158540 KB Output is correct
44 Correct 75 ms 158484 KB Output is correct
45 Correct 84 ms 158620 KB Output is correct
46 Correct 78 ms 158460 KB Output is correct
47 Correct 75 ms 158540 KB Output is correct
48 Correct 77 ms 158504 KB Output is correct
49 Correct 74 ms 157412 KB Output is correct
50 Correct 84 ms 157424 KB Output is correct
51 Correct 77 ms 157516 KB Output is correct
52 Correct 85 ms 157396 KB Output is correct
53 Correct 85 ms 157476 KB Output is correct
54 Correct 77 ms 157424 KB Output is correct
55 Correct 80 ms 157420 KB Output is correct
56 Correct 77 ms 157440 KB Output is correct
57 Correct 77 ms 157424 KB Output is correct
58 Correct 82 ms 157444 KB Output is correct
59 Correct 81 ms 157928 KB Output is correct
60 Correct 77 ms 157984 KB Output is correct
61 Correct 77 ms 156880 KB Output is correct
62 Correct 82 ms 156896 KB Output is correct
63 Correct 88 ms 156944 KB Output is correct
64 Correct 159 ms 165984 KB Output is correct
65 Correct 134 ms 165392 KB Output is correct
66 Correct 120 ms 164904 KB Output is correct
67 Correct 92 ms 164504 KB Output is correct
68 Correct 173 ms 166060 KB Output is correct
69 Correct 142 ms 165292 KB Output is correct
70 Correct 118 ms 164968 KB Output is correct
71 Correct 112 ms 164728 KB Output is correct
72 Correct 160 ms 166640 KB Output is correct
73 Correct 160 ms 166396 KB Output is correct
74 Correct 169 ms 166288 KB Output is correct
75 Correct 150 ms 166240 KB Output is correct
76 Correct 164 ms 166792 KB Output is correct
77 Correct 185 ms 166808 KB Output is correct
78 Correct 162 ms 166772 KB Output is correct
79 Correct 163 ms 166864 KB Output is correct
80 Correct 160 ms 166536 KB Output is correct
81 Correct 132 ms 165836 KB Output is correct
82 Correct 131 ms 165436 KB Output is correct
83 Correct 91 ms 164504 KB Output is correct
84 Correct 147 ms 166508 KB Output is correct
85 Correct 130 ms 165756 KB Output is correct
86 Correct 117 ms 165508 KB Output is correct
87 Correct 111 ms 165376 KB Output is correct
88 Correct 192 ms 166900 KB Output is correct
89 Correct 147 ms 166776 KB Output is correct
90 Correct 149 ms 167024 KB Output is correct
91 Correct 147 ms 166732 KB Output is correct
92 Correct 168 ms 167280 KB Output is correct
93 Correct 162 ms 167360 KB Output is correct
94 Correct 163 ms 167248 KB Output is correct
95 Correct 162 ms 167248 KB Output is correct
96 Correct 98 ms 164384 KB Output is correct
97 Correct 94 ms 164480 KB Output is correct
98 Correct 92 ms 164372 KB Output is correct
99 Correct 93 ms 164424 KB Output is correct
100 Correct 111 ms 164800 KB Output is correct
101 Correct 103 ms 164576 KB Output is correct
102 Correct 113 ms 164808 KB Output is correct
103 Correct 91 ms 164436 KB Output is correct
104 Correct 143 ms 165936 KB Output is correct
105 Correct 126 ms 165244 KB Output is correct
106 Correct 115 ms 164836 KB Output is correct
107 Correct 93 ms 164420 KB Output is correct
108 Correct 146 ms 165660 KB Output is correct
109 Correct 131 ms 165080 KB Output is correct
110 Correct 111 ms 164852 KB Output is correct
111 Correct 93 ms 164480 KB Output is correct
112 Correct 104 ms 162424 KB Output is correct
113 Correct 108 ms 162496 KB Output is correct
114 Correct 100 ms 162468 KB Output is correct
115 Correct 107 ms 162460 KB Output is correct
116 Correct 104 ms 162360 KB Output is correct
117 Correct 104 ms 162416 KB Output is correct
118 Correct 111 ms 162364 KB Output is correct
119 Correct 105 ms 162456 KB Output is correct
120 Correct 100 ms 162460 KB Output is correct
121 Correct 106 ms 162496 KB Output is correct
122 Correct 133 ms 167380 KB Output is correct
123 Correct 126 ms 167288 KB Output is correct
124 Correct 115 ms 158820 KB Output is correct
125 Correct 102 ms 158384 KB Output is correct
126 Correct 100 ms 158176 KB Output is correct
127 Correct 116 ms 158892 KB Output is correct
128 Correct 103 ms 158200 KB Output is correct
129 Correct 102 ms 158316 KB Output is correct
130 Correct 118 ms 158996 KB Output is correct
131 Correct 102 ms 158204 KB Output is correct
132 Correct 103 ms 158328 KB Output is correct
133 Correct 480 ms 173804 KB Output is correct
134 Correct 388 ms 171632 KB Output is correct
135 Correct 290 ms 170632 KB Output is correct
136 Correct 146 ms 168580 KB Output is correct
137 Correct 484 ms 173784 KB Output is correct
138 Correct 389 ms 171500 KB Output is correct
139 Correct 323 ms 170436 KB Output is correct
140 Correct 228 ms 169648 KB Output is correct
141 Correct 508 ms 175464 KB Output is correct
142 Correct 489 ms 174876 KB Output is correct
143 Correct 459 ms 174700 KB Output is correct
144 Correct 451 ms 174516 KB Output is correct
145 Correct 513 ms 176156 KB Output is correct
146 Correct 505 ms 176268 KB Output is correct
147 Correct 506 ms 176360 KB Output is correct
148 Correct 499 ms 176168 KB Output is correct
149 Correct 471 ms 174064 KB Output is correct
150 Correct 372 ms 171936 KB Output is correct
151 Correct 287 ms 170964 KB Output is correct
152 Correct 142 ms 168752 KB Output is correct
153 Correct 492 ms 173856 KB Output is correct
154 Correct 378 ms 171700 KB Output is correct
155 Correct 278 ms 170652 KB Output is correct
156 Correct 220 ms 169776 KB Output is correct
157 Correct 516 ms 175592 KB Output is correct
158 Correct 453 ms 174916 KB Output is correct
159 Correct 466 ms 174800 KB Output is correct
160 Correct 444 ms 174776 KB Output is correct
161 Correct 531 ms 176316 KB Output is correct
162 Correct 500 ms 176320 KB Output is correct
163 Correct 492 ms 176312 KB Output is correct
164 Correct 502 ms 176372 KB Output is correct
165 Correct 131 ms 167868 KB Output is correct
166 Correct 132 ms 167900 KB Output is correct
167 Correct 129 ms 167960 KB Output is correct
168 Correct 133 ms 167868 KB Output is correct
169 Correct 245 ms 169684 KB Output is correct
170 Correct 199 ms 169272 KB Output is correct
171 Correct 188 ms 169152 KB Output is correct
172 Correct 147 ms 168244 KB Output is correct
173 Correct 462 ms 174008 KB Output is correct
174 Correct 353 ms 171348 KB Output is correct
175 Correct 261 ms 169992 KB Output is correct
176 Correct 146 ms 168148 KB Output is correct
177 Correct 463 ms 173460 KB Output is correct
178 Correct 368 ms 170968 KB Output is correct
179 Correct 272 ms 169956 KB Output is correct
180 Correct 160 ms 168268 KB Output is correct
181 Correct 191 ms 168632 KB Output is correct
182 Correct 231 ms 168584 KB Output is correct
183 Correct 194 ms 168252 KB Output is correct
184 Correct 223 ms 168296 KB Output is correct
185 Correct 190 ms 168648 KB Output is correct
186 Correct 237 ms 168752 KB Output is correct
187 Correct 187 ms 168320 KB Output is correct
188 Correct 227 ms 168248 KB Output is correct
189 Correct 200 ms 168564 KB Output is correct
190 Correct 232 ms 168628 KB Output is correct
191 Correct 300 ms 176152 KB Output is correct
192 Correct 284 ms 176072 KB Output is correct
193 Correct 944 ms 211788 KB Output is correct
194 Correct 922 ms 211780 KB Output is correct
195 Correct 1715 ms 260556 KB Output is correct
196 Correct 1721 ms 260428 KB Output is correct
197 Correct 2105 ms 280768 KB Output is correct
198 Correct 2163 ms 280972 KB Output is correct
199 Correct 2661 ms 222460 KB Output is correct
200 Correct 1865 ms 215396 KB Output is correct
201 Correct 1783 ms 214108 KB Output is correct
202 Correct 2949 ms 226664 KB Output is correct
203 Correct 1902 ms 215488 KB Output is correct
204 Correct 1762 ms 214244 KB Output is correct
205 Correct 3115 ms 228436 KB Output is correct
206 Correct 1840 ms 215680 KB Output is correct
207 Correct 1750 ms 214032 KB Output is correct
208 Correct 1103 ms 206744 KB Output is correct
209 Correct 1098 ms 206520 KB Output is correct
210 Correct 1116 ms 206216 KB Output is correct
211 Correct 1137 ms 206780 KB Output is correct
212 Correct 1108 ms 206432 KB Output is correct
213 Correct 5693 ms 258872 KB Output is correct
214 Correct 4573 ms 237552 KB Output is correct
215 Correct 3370 ms 229216 KB Output is correct
216 Correct 1291 ms 214652 KB Output is correct
217 Correct 5761 ms 260008 KB Output is correct
218 Correct 4587 ms 239588 KB Output is correct
219 Correct 3378 ms 230624 KB Output is correct
220 Correct 1741 ms 218772 KB Output is correct
221 Correct 5971 ms 275560 KB Output is correct
222 Correct 5622 ms 269620 KB Output is correct
223 Correct 5393 ms 267904 KB Output is correct
224 Correct 5450 ms 267540 KB Output is correct
225 Correct 6092 ms 281884 KB Output is correct
226 Correct 6058 ms 281716 KB Output is correct
227 Correct 5997 ms 281848 KB Output is correct
228 Correct 5962 ms 281796 KB Output is correct
229 Correct 5766 ms 258868 KB Output is correct
230 Correct 4625 ms 237120 KB Output is correct
231 Correct 3432 ms 229012 KB Output is correct
232 Correct 1296 ms 214376 KB Output is correct
233 Correct 5945 ms 259716 KB Output is correct
234 Correct 4934 ms 238920 KB Output is correct
235 Correct 3443 ms 230548 KB Output is correct
236 Correct 1838 ms 219320 KB Output is correct
237 Correct 6241 ms 275340 KB Output is correct
238 Correct 6471 ms 269512 KB Output is correct
239 Execution timed out 7062 ms 267116 KB Time limit exceeded
240 Halted 0 ms 0 KB -