답안 #604828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
604828 2022-07-25T10:10:46 Z errorgorn Uplifting Excursion (BOI22_vault) C++17
100 / 100
2457 ms 7504 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int INF=1e18;

int n,k;
int arr[305]; //go pos
int brr[305]; //go neg
int num[305]; //range should be [-neg,pos]

const int LEN=150005;
int memo[2][2*LEN];

int ans;

signed main(){
	cin.tie(0);
	cout.tie(0);
	cin.sync_with_stdio(false);
	
	cin>>n>>k;
	rep(x,n+1,1) cin>>arr[x];
	cin>>ans;
	rep(x,1,n+1) cin>>brr[x];
	
	rep(x,1,n+1) ans+=arr[x]+brr[x];
	
	int curr=0;
	rep(x,1,n+1) curr+=(brr[x]-arr[x])*x;
	
	rep(x,n+1,1){
		if (curr<k) num[x]=min(arr[x],(k-curr)/x);
		else num[x]=-min(brr[x],(curr-k)/x);
		
		curr+=num[x]*x;
		ans-=abs(num[x]);
	}
	
	rep(x,0,2*LEN) memo[0][x]=-INF;
	memo[0][LEN]=0;
	
	int a=0,b=1;
	rep(x,1,n+1){
		rep(x,0,2*LEN) memo[b][x]=-INF;
		
		deque<ii> dq; //(val,pos)
		rep(res,0,x){
			dq.clear();
			
			int r=-1;
			for (int i=0;res+i*x<2*LEN;i++){
				while (res+(r+1)*x<2*LEN && r+1<=i+num[x]){
					r++;
					ii temp={memo[a][res+r*x]+r+(num[x]<0?-2*num[x]:0),r};
					while (!dq.empty() && dq.back().fi<=temp.fi) dq.pob();
					dq.pub(temp);
				}
				while (!dq.empty() && dq.front().se<i+(num[x]-arr[x])) dq.pof();
				
				if (!dq.empty()) memo[b][res+i*x]=dq.front().fi-i;
			}
		}
		
		dq.clear();
		rep(res,0,x){
			dq.clear();
			
			int r=-1;
			for (int i=0;res+i*x<2*LEN;i++){
				while (res+(r+1)*x<2*LEN && r+1<=i+(num[x]+brr[x])){
					r++;
					ii temp={memo[a][res+r*x]-r+(num[x]>0?2*num[x]:0),r};
					while (!dq.empty() && dq.back().fi<=temp.fi) dq.pob();
					dq.pub(temp);
				}
				while (!dq.empty() && dq.front().se<i+(num[x])) dq.pof();
				
				if (!dq.empty())
					memo[b][res+i*x]=max(memo[b][res+i*x],dq.front().fi+i);
			}
		}
		
		swap(a,b);
		//rep(x,0,2*LEN){
			//if (memo[a][x]<-INF/10) cout<<"-"<<" ";
			//else cout<<memo[a][x]<<" ";
		//}
		//cout<<endl;
	}
	
	int pos=k-curr+LEN;
	if (0<=pos && pos<2*LEN && memo[a][pos]>-INF/10) cout<<ans+memo[a][pos]<<endl;
	else cout<<"impossible"<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4944 KB Output is correct
2 Correct 29 ms 4968 KB Output is correct
3 Correct 12 ms 5036 KB Output is correct
4 Correct 95 ms 5008 KB Output is correct
5 Correct 471 ms 5012 KB Output is correct
6 Correct 456 ms 5012 KB Output is correct
7 Correct 474 ms 5008 KB Output is correct
8 Correct 449 ms 5008 KB Output is correct
9 Correct 496 ms 5004 KB Output is correct
10 Correct 452 ms 5016 KB Output is correct
11 Correct 475 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4944 KB Output is correct
2 Correct 29 ms 4968 KB Output is correct
3 Correct 12 ms 5036 KB Output is correct
4 Correct 95 ms 5008 KB Output is correct
5 Correct 471 ms 5012 KB Output is correct
6 Correct 456 ms 5012 KB Output is correct
7 Correct 474 ms 5008 KB Output is correct
8 Correct 449 ms 5008 KB Output is correct
9 Correct 496 ms 5004 KB Output is correct
10 Correct 452 ms 5016 KB Output is correct
11 Correct 475 ms 4948 KB Output is correct
12 Correct 18 ms 5032 KB Output is correct
13 Correct 28 ms 4948 KB Output is correct
14 Correct 11 ms 4948 KB Output is correct
15 Correct 93 ms 5004 KB Output is correct
16 Correct 408 ms 5012 KB Output is correct
17 Correct 427 ms 5000 KB Output is correct
18 Correct 409 ms 5016 KB Output is correct
19 Correct 440 ms 5008 KB Output is correct
20 Correct 437 ms 5004 KB Output is correct
21 Correct 414 ms 5012 KB Output is correct
22 Correct 449 ms 5012 KB Output is correct
23 Correct 847 ms 5008 KB Output is correct
24 Correct 769 ms 4948 KB Output is correct
25 Correct 824 ms 5012 KB Output is correct
26 Correct 815 ms 5012 KB Output is correct
27 Correct 811 ms 5016 KB Output is correct
28 Correct 934 ms 5012 KB Output is correct
29 Correct 870 ms 5004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 5004 KB Output is correct
2 Correct 261 ms 5860 KB Output is correct
3 Correct 240 ms 5192 KB Output is correct
4 Correct 214 ms 6220 KB Output is correct
5 Correct 246 ms 5516 KB Output is correct
6 Correct 215 ms 7444 KB Output is correct
7 Correct 291 ms 5140 KB Output is correct
8 Correct 248 ms 5004 KB Output is correct
9 Correct 248 ms 7472 KB Output is correct
10 Correct 299 ms 5404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 5004 KB Output is correct
2 Correct 261 ms 5860 KB Output is correct
3 Correct 240 ms 5192 KB Output is correct
4 Correct 214 ms 6220 KB Output is correct
5 Correct 246 ms 5516 KB Output is correct
6 Correct 215 ms 7444 KB Output is correct
7 Correct 291 ms 5140 KB Output is correct
8 Correct 248 ms 5004 KB Output is correct
9 Correct 248 ms 7472 KB Output is correct
10 Correct 299 ms 5404 KB Output is correct
11 Correct 16 ms 5032 KB Output is correct
12 Correct 25 ms 5028 KB Output is correct
13 Correct 10 ms 5028 KB Output is correct
14 Correct 80 ms 5008 KB Output is correct
15 Correct 246 ms 5860 KB Output is correct
16 Correct 257 ms 5264 KB Output is correct
17 Correct 216 ms 6196 KB Output is correct
18 Correct 228 ms 5516 KB Output is correct
19 Correct 226 ms 7472 KB Output is correct
20 Correct 233 ms 5144 KB Output is correct
21 Correct 263 ms 5008 KB Output is correct
22 Correct 236 ms 7484 KB Output is correct
23 Correct 236 ms 5324 KB Output is correct
24 Correct 264 ms 5860 KB Output is correct
25 Correct 255 ms 5328 KB Output is correct
26 Correct 212 ms 5628 KB Output is correct
27 Correct 243 ms 5644 KB Output is correct
28 Correct 203 ms 7380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 5004 KB Output is correct
2 Correct 261 ms 5860 KB Output is correct
3 Correct 240 ms 5192 KB Output is correct
4 Correct 214 ms 6220 KB Output is correct
5 Correct 246 ms 5516 KB Output is correct
6 Correct 215 ms 7444 KB Output is correct
7 Correct 291 ms 5140 KB Output is correct
8 Correct 248 ms 5004 KB Output is correct
9 Correct 248 ms 7472 KB Output is correct
10 Correct 299 ms 5404 KB Output is correct
11 Correct 114 ms 5012 KB Output is correct
12 Correct 255 ms 5968 KB Output is correct
13 Correct 240 ms 5136 KB Output is correct
14 Correct 218 ms 6228 KB Output is correct
15 Correct 244 ms 5640 KB Output is correct
16 Correct 220 ms 7380 KB Output is correct
17 Correct 239 ms 5132 KB Output is correct
18 Correct 246 ms 5020 KB Output is correct
19 Correct 316 ms 7476 KB Output is correct
20 Correct 276 ms 5324 KB Output is correct
21 Correct 443 ms 5012 KB Output is correct
22 Correct 488 ms 5004 KB Output is correct
23 Correct 448 ms 5512 KB Output is correct
24 Correct 451 ms 5216 KB Output is correct
25 Correct 474 ms 7484 KB Output is correct
26 Correct 414 ms 6228 KB Output is correct
27 Correct 410 ms 7472 KB Output is correct
28 Correct 483 ms 5640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4944 KB Output is correct
2 Correct 29 ms 4968 KB Output is correct
3 Correct 12 ms 5036 KB Output is correct
4 Correct 95 ms 5008 KB Output is correct
5 Correct 471 ms 5012 KB Output is correct
6 Correct 456 ms 5012 KB Output is correct
7 Correct 474 ms 5008 KB Output is correct
8 Correct 449 ms 5008 KB Output is correct
9 Correct 496 ms 5004 KB Output is correct
10 Correct 452 ms 5016 KB Output is correct
11 Correct 475 ms 4948 KB Output is correct
12 Correct 85 ms 5004 KB Output is correct
13 Correct 261 ms 5860 KB Output is correct
14 Correct 240 ms 5192 KB Output is correct
15 Correct 214 ms 6220 KB Output is correct
16 Correct 246 ms 5516 KB Output is correct
17 Correct 215 ms 7444 KB Output is correct
18 Correct 291 ms 5140 KB Output is correct
19 Correct 248 ms 5004 KB Output is correct
20 Correct 248 ms 7472 KB Output is correct
21 Correct 299 ms 5404 KB Output is correct
22 Correct 16 ms 5032 KB Output is correct
23 Correct 25 ms 5028 KB Output is correct
24 Correct 10 ms 5028 KB Output is correct
25 Correct 80 ms 5008 KB Output is correct
26 Correct 246 ms 5860 KB Output is correct
27 Correct 257 ms 5264 KB Output is correct
28 Correct 216 ms 6196 KB Output is correct
29 Correct 228 ms 5516 KB Output is correct
30 Correct 226 ms 7472 KB Output is correct
31 Correct 233 ms 5144 KB Output is correct
32 Correct 263 ms 5008 KB Output is correct
33 Correct 236 ms 7484 KB Output is correct
34 Correct 236 ms 5324 KB Output is correct
35 Correct 264 ms 5860 KB Output is correct
36 Correct 255 ms 5328 KB Output is correct
37 Correct 212 ms 5628 KB Output is correct
38 Correct 243 ms 5644 KB Output is correct
39 Correct 203 ms 7380 KB Output is correct
40 Correct 114 ms 5012 KB Output is correct
41 Correct 255 ms 5968 KB Output is correct
42 Correct 240 ms 5136 KB Output is correct
43 Correct 218 ms 6228 KB Output is correct
44 Correct 244 ms 5640 KB Output is correct
45 Correct 220 ms 7380 KB Output is correct
46 Correct 239 ms 5132 KB Output is correct
47 Correct 246 ms 5020 KB Output is correct
48 Correct 316 ms 7476 KB Output is correct
49 Correct 276 ms 5324 KB Output is correct
50 Correct 443 ms 5012 KB Output is correct
51 Correct 488 ms 5004 KB Output is correct
52 Correct 448 ms 5512 KB Output is correct
53 Correct 451 ms 5216 KB Output is correct
54 Correct 474 ms 7484 KB Output is correct
55 Correct 414 ms 6228 KB Output is correct
56 Correct 410 ms 7472 KB Output is correct
57 Correct 483 ms 5640 KB Output is correct
58 Correct 17 ms 4948 KB Output is correct
59 Correct 30 ms 5036 KB Output is correct
60 Correct 11 ms 5028 KB Output is correct
61 Correct 104 ms 5016 KB Output is correct
62 Correct 393 ms 5016 KB Output is correct
63 Correct 436 ms 5012 KB Output is correct
64 Correct 410 ms 5008 KB Output is correct
65 Correct 427 ms 5020 KB Output is correct
66 Correct 399 ms 5008 KB Output is correct
67 Correct 422 ms 5012 KB Output is correct
68 Correct 556 ms 4948 KB Output is correct
69 Correct 265 ms 5796 KB Output is correct
70 Correct 239 ms 5196 KB Output is correct
71 Correct 218 ms 6228 KB Output is correct
72 Correct 243 ms 5412 KB Output is correct
73 Correct 216 ms 7380 KB Output is correct
74 Correct 233 ms 5192 KB Output is correct
75 Correct 304 ms 5096 KB Output is correct
76 Correct 240 ms 7480 KB Output is correct
77 Correct 244 ms 5404 KB Output is correct
78 Correct 240 ms 5828 KB Output is correct
79 Correct 246 ms 5320 KB Output is correct
80 Correct 206 ms 5608 KB Output is correct
81 Correct 236 ms 5624 KB Output is correct
82 Correct 206 ms 7476 KB Output is correct
83 Correct 452 ms 5580 KB Output is correct
84 Correct 450 ms 5212 KB Output is correct
85 Correct 395 ms 7492 KB Output is correct
86 Correct 378 ms 6228 KB Output is correct
87 Correct 409 ms 7480 KB Output is correct
88 Correct 392 ms 5628 KB Output is correct
89 Correct 434 ms 5608 KB Output is correct
90 Correct 386 ms 5964 KB Output is correct
91 Correct 385 ms 7428 KB Output is correct
92 Correct 308 ms 7476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 5004 KB Output is correct
2 Correct 261 ms 5860 KB Output is correct
3 Correct 240 ms 5192 KB Output is correct
4 Correct 214 ms 6220 KB Output is correct
5 Correct 246 ms 5516 KB Output is correct
6 Correct 215 ms 7444 KB Output is correct
7 Correct 291 ms 5140 KB Output is correct
8 Correct 248 ms 5004 KB Output is correct
9 Correct 248 ms 7472 KB Output is correct
10 Correct 299 ms 5404 KB Output is correct
11 Correct 114 ms 5012 KB Output is correct
12 Correct 255 ms 5968 KB Output is correct
13 Correct 240 ms 5136 KB Output is correct
14 Correct 218 ms 6228 KB Output is correct
15 Correct 244 ms 5640 KB Output is correct
16 Correct 220 ms 7380 KB Output is correct
17 Correct 239 ms 5132 KB Output is correct
18 Correct 246 ms 5020 KB Output is correct
19 Correct 316 ms 7476 KB Output is correct
20 Correct 276 ms 5324 KB Output is correct
21 Correct 443 ms 5012 KB Output is correct
22 Correct 488 ms 5004 KB Output is correct
23 Correct 448 ms 5512 KB Output is correct
24 Correct 451 ms 5216 KB Output is correct
25 Correct 474 ms 7484 KB Output is correct
26 Correct 414 ms 6228 KB Output is correct
27 Correct 410 ms 7472 KB Output is correct
28 Correct 483 ms 5640 KB Output is correct
29 Correct 81 ms 5012 KB Output is correct
30 Correct 261 ms 5864 KB Output is correct
31 Correct 233 ms 5148 KB Output is correct
32 Correct 214 ms 6256 KB Output is correct
33 Correct 238 ms 5516 KB Output is correct
34 Correct 217 ms 7476 KB Output is correct
35 Correct 238 ms 5136 KB Output is correct
36 Correct 234 ms 5068 KB Output is correct
37 Correct 237 ms 7476 KB Output is correct
38 Correct 242 ms 5392 KB Output is correct
39 Correct 385 ms 4948 KB Output is correct
40 Correct 421 ms 5008 KB Output is correct
41 Correct 404 ms 5512 KB Output is correct
42 Correct 405 ms 5216 KB Output is correct
43 Correct 378 ms 7380 KB Output is correct
44 Correct 347 ms 6256 KB Output is correct
45 Correct 335 ms 7476 KB Output is correct
46 Correct 398 ms 5636 KB Output is correct
47 Correct 780 ms 5008 KB Output is correct
48 Correct 786 ms 5012 KB Output is correct
49 Correct 776 ms 7380 KB Output is correct
50 Correct 786 ms 5116 KB Output is correct
51 Correct 712 ms 7476 KB Output is correct
52 Correct 737 ms 6228 KB Output is correct
53 Correct 629 ms 7476 KB Output is correct
54 Correct 753 ms 6228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4944 KB Output is correct
2 Correct 29 ms 4968 KB Output is correct
3 Correct 12 ms 5036 KB Output is correct
4 Correct 95 ms 5008 KB Output is correct
5 Correct 471 ms 5012 KB Output is correct
6 Correct 456 ms 5012 KB Output is correct
7 Correct 474 ms 5008 KB Output is correct
8 Correct 449 ms 5008 KB Output is correct
9 Correct 496 ms 5004 KB Output is correct
10 Correct 452 ms 5016 KB Output is correct
11 Correct 475 ms 4948 KB Output is correct
12 Correct 18 ms 5032 KB Output is correct
13 Correct 28 ms 4948 KB Output is correct
14 Correct 11 ms 4948 KB Output is correct
15 Correct 93 ms 5004 KB Output is correct
16 Correct 408 ms 5012 KB Output is correct
17 Correct 427 ms 5000 KB Output is correct
18 Correct 409 ms 5016 KB Output is correct
19 Correct 440 ms 5008 KB Output is correct
20 Correct 437 ms 5004 KB Output is correct
21 Correct 414 ms 5012 KB Output is correct
22 Correct 449 ms 5012 KB Output is correct
23 Correct 847 ms 5008 KB Output is correct
24 Correct 769 ms 4948 KB Output is correct
25 Correct 824 ms 5012 KB Output is correct
26 Correct 815 ms 5012 KB Output is correct
27 Correct 811 ms 5016 KB Output is correct
28 Correct 934 ms 5012 KB Output is correct
29 Correct 870 ms 5004 KB Output is correct
30 Correct 85 ms 5004 KB Output is correct
31 Correct 261 ms 5860 KB Output is correct
32 Correct 240 ms 5192 KB Output is correct
33 Correct 214 ms 6220 KB Output is correct
34 Correct 246 ms 5516 KB Output is correct
35 Correct 215 ms 7444 KB Output is correct
36 Correct 291 ms 5140 KB Output is correct
37 Correct 248 ms 5004 KB Output is correct
38 Correct 248 ms 7472 KB Output is correct
39 Correct 299 ms 5404 KB Output is correct
40 Correct 16 ms 5032 KB Output is correct
41 Correct 25 ms 5028 KB Output is correct
42 Correct 10 ms 5028 KB Output is correct
43 Correct 80 ms 5008 KB Output is correct
44 Correct 246 ms 5860 KB Output is correct
45 Correct 257 ms 5264 KB Output is correct
46 Correct 216 ms 6196 KB Output is correct
47 Correct 228 ms 5516 KB Output is correct
48 Correct 226 ms 7472 KB Output is correct
49 Correct 233 ms 5144 KB Output is correct
50 Correct 263 ms 5008 KB Output is correct
51 Correct 236 ms 7484 KB Output is correct
52 Correct 236 ms 5324 KB Output is correct
53 Correct 264 ms 5860 KB Output is correct
54 Correct 255 ms 5328 KB Output is correct
55 Correct 212 ms 5628 KB Output is correct
56 Correct 243 ms 5644 KB Output is correct
57 Correct 203 ms 7380 KB Output is correct
58 Correct 114 ms 5012 KB Output is correct
59 Correct 255 ms 5968 KB Output is correct
60 Correct 240 ms 5136 KB Output is correct
61 Correct 218 ms 6228 KB Output is correct
62 Correct 244 ms 5640 KB Output is correct
63 Correct 220 ms 7380 KB Output is correct
64 Correct 239 ms 5132 KB Output is correct
65 Correct 246 ms 5020 KB Output is correct
66 Correct 316 ms 7476 KB Output is correct
67 Correct 276 ms 5324 KB Output is correct
68 Correct 443 ms 5012 KB Output is correct
69 Correct 488 ms 5004 KB Output is correct
70 Correct 448 ms 5512 KB Output is correct
71 Correct 451 ms 5216 KB Output is correct
72 Correct 474 ms 7484 KB Output is correct
73 Correct 414 ms 6228 KB Output is correct
74 Correct 410 ms 7472 KB Output is correct
75 Correct 483 ms 5640 KB Output is correct
76 Correct 17 ms 4948 KB Output is correct
77 Correct 30 ms 5036 KB Output is correct
78 Correct 11 ms 5028 KB Output is correct
79 Correct 104 ms 5016 KB Output is correct
80 Correct 393 ms 5016 KB Output is correct
81 Correct 436 ms 5012 KB Output is correct
82 Correct 410 ms 5008 KB Output is correct
83 Correct 427 ms 5020 KB Output is correct
84 Correct 399 ms 5008 KB Output is correct
85 Correct 422 ms 5012 KB Output is correct
86 Correct 556 ms 4948 KB Output is correct
87 Correct 265 ms 5796 KB Output is correct
88 Correct 239 ms 5196 KB Output is correct
89 Correct 218 ms 6228 KB Output is correct
90 Correct 243 ms 5412 KB Output is correct
91 Correct 216 ms 7380 KB Output is correct
92 Correct 233 ms 5192 KB Output is correct
93 Correct 304 ms 5096 KB Output is correct
94 Correct 240 ms 7480 KB Output is correct
95 Correct 244 ms 5404 KB Output is correct
96 Correct 240 ms 5828 KB Output is correct
97 Correct 246 ms 5320 KB Output is correct
98 Correct 206 ms 5608 KB Output is correct
99 Correct 236 ms 5624 KB Output is correct
100 Correct 206 ms 7476 KB Output is correct
101 Correct 452 ms 5580 KB Output is correct
102 Correct 450 ms 5212 KB Output is correct
103 Correct 395 ms 7492 KB Output is correct
104 Correct 378 ms 6228 KB Output is correct
105 Correct 409 ms 7480 KB Output is correct
106 Correct 392 ms 5628 KB Output is correct
107 Correct 434 ms 5608 KB Output is correct
108 Correct 386 ms 5964 KB Output is correct
109 Correct 385 ms 7428 KB Output is correct
110 Correct 308 ms 7476 KB Output is correct
111 Correct 81 ms 5012 KB Output is correct
112 Correct 261 ms 5864 KB Output is correct
113 Correct 233 ms 5148 KB Output is correct
114 Correct 214 ms 6256 KB Output is correct
115 Correct 238 ms 5516 KB Output is correct
116 Correct 217 ms 7476 KB Output is correct
117 Correct 238 ms 5136 KB Output is correct
118 Correct 234 ms 5068 KB Output is correct
119 Correct 237 ms 7476 KB Output is correct
120 Correct 242 ms 5392 KB Output is correct
121 Correct 385 ms 4948 KB Output is correct
122 Correct 421 ms 5008 KB Output is correct
123 Correct 404 ms 5512 KB Output is correct
124 Correct 405 ms 5216 KB Output is correct
125 Correct 378 ms 7380 KB Output is correct
126 Correct 347 ms 6256 KB Output is correct
127 Correct 335 ms 7476 KB Output is correct
128 Correct 398 ms 5636 KB Output is correct
129 Correct 780 ms 5008 KB Output is correct
130 Correct 786 ms 5012 KB Output is correct
131 Correct 776 ms 7380 KB Output is correct
132 Correct 786 ms 5116 KB Output is correct
133 Correct 712 ms 7476 KB Output is correct
134 Correct 737 ms 6228 KB Output is correct
135 Correct 629 ms 7476 KB Output is correct
136 Correct 753 ms 6228 KB Output is correct
137 Correct 16 ms 5076 KB Output is correct
138 Correct 25 ms 4948 KB Output is correct
139 Correct 9 ms 4948 KB Output is correct
140 Correct 78 ms 5012 KB Output is correct
141 Correct 381 ms 5012 KB Output is correct
142 Correct 371 ms 5008 KB Output is correct
143 Correct 377 ms 5012 KB Output is correct
144 Correct 390 ms 5016 KB Output is correct
145 Correct 379 ms 4948 KB Output is correct
146 Correct 387 ms 5008 KB Output is correct
147 Correct 387 ms 5020 KB Output is correct
148 Correct 754 ms 5028 KB Output is correct
149 Correct 767 ms 5016 KB Output is correct
150 Correct 801 ms 5012 KB Output is correct
151 Correct 736 ms 5008 KB Output is correct
152 Correct 754 ms 5012 KB Output is correct
153 Correct 777 ms 5012 KB Output is correct
154 Correct 779 ms 5016 KB Output is correct
155 Correct 235 ms 5860 KB Output is correct
156 Correct 236 ms 5156 KB Output is correct
157 Correct 221 ms 6252 KB Output is correct
158 Correct 223 ms 5536 KB Output is correct
159 Correct 223 ms 7472 KB Output is correct
160 Correct 238 ms 5140 KB Output is correct
161 Correct 227 ms 5100 KB Output is correct
162 Correct 237 ms 7484 KB Output is correct
163 Correct 240 ms 5332 KB Output is correct
164 Correct 381 ms 5516 KB Output is correct
165 Correct 404 ms 5216 KB Output is correct
166 Correct 388 ms 7480 KB Output is correct
167 Correct 344 ms 6244 KB Output is correct
168 Correct 328 ms 7380 KB Output is correct
169 Correct 400 ms 5580 KB Output is correct
170 Correct 238 ms 5860 KB Output is correct
171 Correct 242 ms 5320 KB Output is correct
172 Correct 197 ms 5588 KB Output is correct
173 Correct 222 ms 5628 KB Output is correct
174 Correct 188 ms 7480 KB Output is correct
175 Correct 397 ms 5628 KB Output is correct
176 Correct 391 ms 5852 KB Output is correct
177 Correct 356 ms 7476 KB Output is correct
178 Correct 316 ms 7480 KB Output is correct
179 Correct 778 ms 7476 KB Output is correct
180 Correct 790 ms 5112 KB Output is correct
181 Correct 746 ms 7500 KB Output is correct
182 Correct 724 ms 6220 KB Output is correct
183 Correct 640 ms 7476 KB Output is correct
184 Correct 785 ms 6304 KB Output is correct
185 Correct 755 ms 6260 KB Output is correct
186 Correct 727 ms 6228 KB Output is correct
187 Correct 794 ms 5840 KB Output is correct
188 Correct 646 ms 7476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 5004 KB Output is correct
2 Correct 261 ms 5860 KB Output is correct
3 Correct 240 ms 5192 KB Output is correct
4 Correct 214 ms 6220 KB Output is correct
5 Correct 246 ms 5516 KB Output is correct
6 Correct 215 ms 7444 KB Output is correct
7 Correct 291 ms 5140 KB Output is correct
8 Correct 248 ms 5004 KB Output is correct
9 Correct 248 ms 7472 KB Output is correct
10 Correct 299 ms 5404 KB Output is correct
11 Correct 114 ms 5012 KB Output is correct
12 Correct 255 ms 5968 KB Output is correct
13 Correct 240 ms 5136 KB Output is correct
14 Correct 218 ms 6228 KB Output is correct
15 Correct 244 ms 5640 KB Output is correct
16 Correct 220 ms 7380 KB Output is correct
17 Correct 239 ms 5132 KB Output is correct
18 Correct 246 ms 5020 KB Output is correct
19 Correct 316 ms 7476 KB Output is correct
20 Correct 276 ms 5324 KB Output is correct
21 Correct 443 ms 5012 KB Output is correct
22 Correct 488 ms 5004 KB Output is correct
23 Correct 448 ms 5512 KB Output is correct
24 Correct 451 ms 5216 KB Output is correct
25 Correct 474 ms 7484 KB Output is correct
26 Correct 414 ms 6228 KB Output is correct
27 Correct 410 ms 7472 KB Output is correct
28 Correct 483 ms 5640 KB Output is correct
29 Correct 81 ms 5012 KB Output is correct
30 Correct 261 ms 5864 KB Output is correct
31 Correct 233 ms 5148 KB Output is correct
32 Correct 214 ms 6256 KB Output is correct
33 Correct 238 ms 5516 KB Output is correct
34 Correct 217 ms 7476 KB Output is correct
35 Correct 238 ms 5136 KB Output is correct
36 Correct 234 ms 5068 KB Output is correct
37 Correct 237 ms 7476 KB Output is correct
38 Correct 242 ms 5392 KB Output is correct
39 Correct 385 ms 4948 KB Output is correct
40 Correct 421 ms 5008 KB Output is correct
41 Correct 404 ms 5512 KB Output is correct
42 Correct 405 ms 5216 KB Output is correct
43 Correct 378 ms 7380 KB Output is correct
44 Correct 347 ms 6256 KB Output is correct
45 Correct 335 ms 7476 KB Output is correct
46 Correct 398 ms 5636 KB Output is correct
47 Correct 780 ms 5008 KB Output is correct
48 Correct 786 ms 5012 KB Output is correct
49 Correct 776 ms 7380 KB Output is correct
50 Correct 786 ms 5116 KB Output is correct
51 Correct 712 ms 7476 KB Output is correct
52 Correct 737 ms 6228 KB Output is correct
53 Correct 629 ms 7476 KB Output is correct
54 Correct 753 ms 6228 KB Output is correct
55 Correct 76 ms 4948 KB Output is correct
56 Correct 238 ms 5852 KB Output is correct
57 Correct 241 ms 5068 KB Output is correct
58 Correct 207 ms 6228 KB Output is correct
59 Correct 225 ms 5512 KB Output is correct
60 Correct 227 ms 7504 KB Output is correct
61 Correct 225 ms 5068 KB Output is correct
62 Correct 235 ms 5016 KB Output is correct
63 Correct 236 ms 7372 KB Output is correct
64 Correct 235 ms 5324 KB Output is correct
65 Correct 396 ms 5012 KB Output is correct
66 Correct 385 ms 5008 KB Output is correct
67 Correct 396 ms 5520 KB Output is correct
68 Correct 400 ms 5212 KB Output is correct
69 Correct 414 ms 7492 KB Output is correct
70 Correct 344 ms 6228 KB Output is correct
71 Correct 319 ms 7492 KB Output is correct
72 Correct 393 ms 5620 KB Output is correct
73 Correct 792 ms 5004 KB Output is correct
74 Correct 793 ms 4948 KB Output is correct
75 Correct 791 ms 7480 KB Output is correct
76 Correct 769 ms 5112 KB Output is correct
77 Correct 708 ms 7480 KB Output is correct
78 Correct 738 ms 6220 KB Output is correct
79 Correct 637 ms 7472 KB Output is correct
80 Correct 772 ms 6228 KB Output is correct
81 Correct 2359 ms 5836 KB Output is correct
82 Correct 2344 ms 5324 KB Output is correct
83 Correct 2348 ms 6220 KB Output is correct
84 Correct 2078 ms 7380 KB Output is correct
85 Correct 2360 ms 5008 KB Output is correct
86 Correct 2351 ms 5020 KB Output is correct
87 Correct 2390 ms 6228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 4944 KB Output is correct
2 Correct 29 ms 4968 KB Output is correct
3 Correct 12 ms 5036 KB Output is correct
4 Correct 95 ms 5008 KB Output is correct
5 Correct 471 ms 5012 KB Output is correct
6 Correct 456 ms 5012 KB Output is correct
7 Correct 474 ms 5008 KB Output is correct
8 Correct 449 ms 5008 KB Output is correct
9 Correct 496 ms 5004 KB Output is correct
10 Correct 452 ms 5016 KB Output is correct
11 Correct 475 ms 4948 KB Output is correct
12 Correct 18 ms 5032 KB Output is correct
13 Correct 28 ms 4948 KB Output is correct
14 Correct 11 ms 4948 KB Output is correct
15 Correct 93 ms 5004 KB Output is correct
16 Correct 408 ms 5012 KB Output is correct
17 Correct 427 ms 5000 KB Output is correct
18 Correct 409 ms 5016 KB Output is correct
19 Correct 440 ms 5008 KB Output is correct
20 Correct 437 ms 5004 KB Output is correct
21 Correct 414 ms 5012 KB Output is correct
22 Correct 449 ms 5012 KB Output is correct
23 Correct 847 ms 5008 KB Output is correct
24 Correct 769 ms 4948 KB Output is correct
25 Correct 824 ms 5012 KB Output is correct
26 Correct 815 ms 5012 KB Output is correct
27 Correct 811 ms 5016 KB Output is correct
28 Correct 934 ms 5012 KB Output is correct
29 Correct 870 ms 5004 KB Output is correct
30 Correct 85 ms 5004 KB Output is correct
31 Correct 261 ms 5860 KB Output is correct
32 Correct 240 ms 5192 KB Output is correct
33 Correct 214 ms 6220 KB Output is correct
34 Correct 246 ms 5516 KB Output is correct
35 Correct 215 ms 7444 KB Output is correct
36 Correct 291 ms 5140 KB Output is correct
37 Correct 248 ms 5004 KB Output is correct
38 Correct 248 ms 7472 KB Output is correct
39 Correct 299 ms 5404 KB Output is correct
40 Correct 16 ms 5032 KB Output is correct
41 Correct 25 ms 5028 KB Output is correct
42 Correct 10 ms 5028 KB Output is correct
43 Correct 80 ms 5008 KB Output is correct
44 Correct 246 ms 5860 KB Output is correct
45 Correct 257 ms 5264 KB Output is correct
46 Correct 216 ms 6196 KB Output is correct
47 Correct 228 ms 5516 KB Output is correct
48 Correct 226 ms 7472 KB Output is correct
49 Correct 233 ms 5144 KB Output is correct
50 Correct 263 ms 5008 KB Output is correct
51 Correct 236 ms 7484 KB Output is correct
52 Correct 236 ms 5324 KB Output is correct
53 Correct 264 ms 5860 KB Output is correct
54 Correct 255 ms 5328 KB Output is correct
55 Correct 212 ms 5628 KB Output is correct
56 Correct 243 ms 5644 KB Output is correct
57 Correct 203 ms 7380 KB Output is correct
58 Correct 114 ms 5012 KB Output is correct
59 Correct 255 ms 5968 KB Output is correct
60 Correct 240 ms 5136 KB Output is correct
61 Correct 218 ms 6228 KB Output is correct
62 Correct 244 ms 5640 KB Output is correct
63 Correct 220 ms 7380 KB Output is correct
64 Correct 239 ms 5132 KB Output is correct
65 Correct 246 ms 5020 KB Output is correct
66 Correct 316 ms 7476 KB Output is correct
67 Correct 276 ms 5324 KB Output is correct
68 Correct 443 ms 5012 KB Output is correct
69 Correct 488 ms 5004 KB Output is correct
70 Correct 448 ms 5512 KB Output is correct
71 Correct 451 ms 5216 KB Output is correct
72 Correct 474 ms 7484 KB Output is correct
73 Correct 414 ms 6228 KB Output is correct
74 Correct 410 ms 7472 KB Output is correct
75 Correct 483 ms 5640 KB Output is correct
76 Correct 17 ms 4948 KB Output is correct
77 Correct 30 ms 5036 KB Output is correct
78 Correct 11 ms 5028 KB Output is correct
79 Correct 104 ms 5016 KB Output is correct
80 Correct 393 ms 5016 KB Output is correct
81 Correct 436 ms 5012 KB Output is correct
82 Correct 410 ms 5008 KB Output is correct
83 Correct 427 ms 5020 KB Output is correct
84 Correct 399 ms 5008 KB Output is correct
85 Correct 422 ms 5012 KB Output is correct
86 Correct 556 ms 4948 KB Output is correct
87 Correct 265 ms 5796 KB Output is correct
88 Correct 239 ms 5196 KB Output is correct
89 Correct 218 ms 6228 KB Output is correct
90 Correct 243 ms 5412 KB Output is correct
91 Correct 216 ms 7380 KB Output is correct
92 Correct 233 ms 5192 KB Output is correct
93 Correct 304 ms 5096 KB Output is correct
94 Correct 240 ms 7480 KB Output is correct
95 Correct 244 ms 5404 KB Output is correct
96 Correct 240 ms 5828 KB Output is correct
97 Correct 246 ms 5320 KB Output is correct
98 Correct 206 ms 5608 KB Output is correct
99 Correct 236 ms 5624 KB Output is correct
100 Correct 206 ms 7476 KB Output is correct
101 Correct 452 ms 5580 KB Output is correct
102 Correct 450 ms 5212 KB Output is correct
103 Correct 395 ms 7492 KB Output is correct
104 Correct 378 ms 6228 KB Output is correct
105 Correct 409 ms 7480 KB Output is correct
106 Correct 392 ms 5628 KB Output is correct
107 Correct 434 ms 5608 KB Output is correct
108 Correct 386 ms 5964 KB Output is correct
109 Correct 385 ms 7428 KB Output is correct
110 Correct 308 ms 7476 KB Output is correct
111 Correct 81 ms 5012 KB Output is correct
112 Correct 261 ms 5864 KB Output is correct
113 Correct 233 ms 5148 KB Output is correct
114 Correct 214 ms 6256 KB Output is correct
115 Correct 238 ms 5516 KB Output is correct
116 Correct 217 ms 7476 KB Output is correct
117 Correct 238 ms 5136 KB Output is correct
118 Correct 234 ms 5068 KB Output is correct
119 Correct 237 ms 7476 KB Output is correct
120 Correct 242 ms 5392 KB Output is correct
121 Correct 385 ms 4948 KB Output is correct
122 Correct 421 ms 5008 KB Output is correct
123 Correct 404 ms 5512 KB Output is correct
124 Correct 405 ms 5216 KB Output is correct
125 Correct 378 ms 7380 KB Output is correct
126 Correct 347 ms 6256 KB Output is correct
127 Correct 335 ms 7476 KB Output is correct
128 Correct 398 ms 5636 KB Output is correct
129 Correct 780 ms 5008 KB Output is correct
130 Correct 786 ms 5012 KB Output is correct
131 Correct 776 ms 7380 KB Output is correct
132 Correct 786 ms 5116 KB Output is correct
133 Correct 712 ms 7476 KB Output is correct
134 Correct 737 ms 6228 KB Output is correct
135 Correct 629 ms 7476 KB Output is correct
136 Correct 753 ms 6228 KB Output is correct
137 Correct 16 ms 5076 KB Output is correct
138 Correct 25 ms 4948 KB Output is correct
139 Correct 9 ms 4948 KB Output is correct
140 Correct 78 ms 5012 KB Output is correct
141 Correct 381 ms 5012 KB Output is correct
142 Correct 371 ms 5008 KB Output is correct
143 Correct 377 ms 5012 KB Output is correct
144 Correct 390 ms 5016 KB Output is correct
145 Correct 379 ms 4948 KB Output is correct
146 Correct 387 ms 5008 KB Output is correct
147 Correct 387 ms 5020 KB Output is correct
148 Correct 754 ms 5028 KB Output is correct
149 Correct 767 ms 5016 KB Output is correct
150 Correct 801 ms 5012 KB Output is correct
151 Correct 736 ms 5008 KB Output is correct
152 Correct 754 ms 5012 KB Output is correct
153 Correct 777 ms 5012 KB Output is correct
154 Correct 779 ms 5016 KB Output is correct
155 Correct 235 ms 5860 KB Output is correct
156 Correct 236 ms 5156 KB Output is correct
157 Correct 221 ms 6252 KB Output is correct
158 Correct 223 ms 5536 KB Output is correct
159 Correct 223 ms 7472 KB Output is correct
160 Correct 238 ms 5140 KB Output is correct
161 Correct 227 ms 5100 KB Output is correct
162 Correct 237 ms 7484 KB Output is correct
163 Correct 240 ms 5332 KB Output is correct
164 Correct 381 ms 5516 KB Output is correct
165 Correct 404 ms 5216 KB Output is correct
166 Correct 388 ms 7480 KB Output is correct
167 Correct 344 ms 6244 KB Output is correct
168 Correct 328 ms 7380 KB Output is correct
169 Correct 400 ms 5580 KB Output is correct
170 Correct 238 ms 5860 KB Output is correct
171 Correct 242 ms 5320 KB Output is correct
172 Correct 197 ms 5588 KB Output is correct
173 Correct 222 ms 5628 KB Output is correct
174 Correct 188 ms 7480 KB Output is correct
175 Correct 397 ms 5628 KB Output is correct
176 Correct 391 ms 5852 KB Output is correct
177 Correct 356 ms 7476 KB Output is correct
178 Correct 316 ms 7480 KB Output is correct
179 Correct 778 ms 7476 KB Output is correct
180 Correct 790 ms 5112 KB Output is correct
181 Correct 746 ms 7500 KB Output is correct
182 Correct 724 ms 6220 KB Output is correct
183 Correct 640 ms 7476 KB Output is correct
184 Correct 785 ms 6304 KB Output is correct
185 Correct 755 ms 6260 KB Output is correct
186 Correct 727 ms 6228 KB Output is correct
187 Correct 794 ms 5840 KB Output is correct
188 Correct 646 ms 7476 KB Output is correct
189 Correct 76 ms 4948 KB Output is correct
190 Correct 238 ms 5852 KB Output is correct
191 Correct 241 ms 5068 KB Output is correct
192 Correct 207 ms 6228 KB Output is correct
193 Correct 225 ms 5512 KB Output is correct
194 Correct 227 ms 7504 KB Output is correct
195 Correct 225 ms 5068 KB Output is correct
196 Correct 235 ms 5016 KB Output is correct
197 Correct 236 ms 7372 KB Output is correct
198 Correct 235 ms 5324 KB Output is correct
199 Correct 396 ms 5012 KB Output is correct
200 Correct 385 ms 5008 KB Output is correct
201 Correct 396 ms 5520 KB Output is correct
202 Correct 400 ms 5212 KB Output is correct
203 Correct 414 ms 7492 KB Output is correct
204 Correct 344 ms 6228 KB Output is correct
205 Correct 319 ms 7492 KB Output is correct
206 Correct 393 ms 5620 KB Output is correct
207 Correct 792 ms 5004 KB Output is correct
208 Correct 793 ms 4948 KB Output is correct
209 Correct 791 ms 7480 KB Output is correct
210 Correct 769 ms 5112 KB Output is correct
211 Correct 708 ms 7480 KB Output is correct
212 Correct 738 ms 6220 KB Output is correct
213 Correct 637 ms 7472 KB Output is correct
214 Correct 772 ms 6228 KB Output is correct
215 Correct 2359 ms 5836 KB Output is correct
216 Correct 2344 ms 5324 KB Output is correct
217 Correct 2348 ms 6220 KB Output is correct
218 Correct 2078 ms 7380 KB Output is correct
219 Correct 2360 ms 5008 KB Output is correct
220 Correct 2351 ms 5020 KB Output is correct
221 Correct 2390 ms 6228 KB Output is correct
222 Correct 79 ms 5020 KB Output is correct
223 Correct 251 ms 5856 KB Output is correct
224 Correct 232 ms 5212 KB Output is correct
225 Correct 221 ms 6228 KB Output is correct
226 Correct 225 ms 5452 KB Output is correct
227 Correct 235 ms 7472 KB Output is correct
228 Correct 257 ms 5264 KB Output is correct
229 Correct 244 ms 5008 KB Output is correct
230 Correct 227 ms 7476 KB Output is correct
231 Correct 253 ms 5324 KB Output is correct
232 Correct 424 ms 5004 KB Output is correct
233 Correct 446 ms 5008 KB Output is correct
234 Correct 398 ms 5520 KB Output is correct
235 Correct 411 ms 5212 KB Output is correct
236 Correct 392 ms 7472 KB Output is correct
237 Correct 347 ms 6256 KB Output is correct
238 Correct 344 ms 7484 KB Output is correct
239 Correct 436 ms 5616 KB Output is correct
240 Correct 787 ms 5008 KB Output is correct
241 Correct 834 ms 5012 KB Output is correct
242 Correct 815 ms 7480 KB Output is correct
243 Correct 815 ms 5112 KB Output is correct
244 Correct 734 ms 7464 KB Output is correct
245 Correct 733 ms 6228 KB Output is correct
246 Correct 679 ms 7480 KB Output is correct
247 Correct 802 ms 6268 KB Output is correct
248 Correct 16 ms 4948 KB Output is correct
249 Correct 25 ms 5032 KB Output is correct
250 Correct 9 ms 5020 KB Output is correct
251 Correct 386 ms 5012 KB Output is correct
252 Correct 391 ms 5024 KB Output is correct
253 Correct 443 ms 5008 KB Output is correct
254 Correct 383 ms 5008 KB Output is correct
255 Correct 378 ms 5008 KB Output is correct
256 Correct 755 ms 5028 KB Output is correct
257 Correct 775 ms 5016 KB Output is correct
258 Correct 784 ms 5068 KB Output is correct
259 Correct 732 ms 5008 KB Output is correct
260 Correct 737 ms 5016 KB Output is correct
261 Correct 250 ms 5856 KB Output is correct
262 Correct 247 ms 5332 KB Output is correct
263 Correct 190 ms 5588 KB Output is correct
264 Correct 228 ms 5632 KB Output is correct
265 Correct 197 ms 7380 KB Output is correct
266 Correct 390 ms 5616 KB Output is correct
267 Correct 388 ms 5860 KB Output is correct
268 Correct 361 ms 7480 KB Output is correct
269 Correct 323 ms 7380 KB Output is correct
270 Correct 817 ms 6256 KB Output is correct
271 Correct 740 ms 6256 KB Output is correct
272 Correct 812 ms 5860 KB Output is correct
273 Correct 627 ms 7472 KB Output is correct
274 Correct 2317 ms 5860 KB Output is correct
275 Correct 2308 ms 5428 KB Output is correct
276 Correct 2312 ms 6228 KB Output is correct
277 Correct 2054 ms 7380 KB Output is correct
278 Correct 2414 ms 5008 KB Output is correct
279 Correct 2457 ms 5012 KB Output is correct
280 Correct 2425 ms 6228 KB Output is correct
281 Correct 2241 ms 5440 KB Output is correct
282 Correct 1740 ms 6228 KB Output is correct
283 Correct 2107 ms 6228 KB Output is correct