Submission #701337

# Submission time Handle Problem Language Result Execution time Memory
701337 2023-02-21T01:23:04 Z angelo_torres Uplifting Excursion (BOI22_vault) C++17
5 / 100
1041 ms 828 KB
#include <bits/stdc++.h>

using namespace std;
const int N = 63750;
const int inf = 1e9;
int m,l,a[300],dp[N*2+10];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> m >> l;
	for(int i = -m; i <= m; ++i) cin >> a[i+50];
	for(int i = -N; i <= N; ++i) dp[i+N] = -inf;
	dp[0+N] = 0;
	set<int> s;
	s.insert(0);
	for(int i = -m; i <= m; ++i){
		for(int j = 0; j < a[i+50]; ++j){
			if(i > 0) for(int k = N; k >= -N; k--){
				if(k-i < -N || k-i > N) continue;
				dp[k+N] = max(dp[k+N],dp[k-i+N]+1);
			}
			else for(int k = -N; k <= N; ++k){
				if(k-i < -N || k-i > N) continue;
				dp[k+N] = max(dp[k+N],dp[k-i+N]+1);
			}
			// for(int k = -5; k <= 5; ++k) cout << dp[N+k] << " ";
			// cout << "\n";
		}
	}
	if(l < -N || l > N || dp[l+N] < 0){
		cout << "impossible\n";
	}else{
		cout << dp[l+N] << "\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 804 KB Output is correct
4 Correct 8 ms 724 KB Output is correct
5 Correct 0 ms 724 KB Output is correct
6 Correct 350 ms 724 KB Output is correct
7 Correct 135 ms 808 KB Output is correct
8 Correct 329 ms 804 KB Output is correct
9 Correct 613 ms 804 KB Output is correct
10 Correct 16 ms 724 KB Output is correct
11 Correct 12 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 804 KB Output is correct
4 Correct 8 ms 724 KB Output is correct
5 Correct 0 ms 724 KB Output is correct
6 Correct 350 ms 724 KB Output is correct
7 Correct 135 ms 808 KB Output is correct
8 Correct 329 ms 804 KB Output is correct
9 Correct 613 ms 804 KB Output is correct
10 Correct 16 ms 724 KB Output is correct
11 Correct 12 ms 812 KB Output is correct
12 Correct 2 ms 724 KB Output is correct
13 Correct 3 ms 724 KB Output is correct
14 Correct 2 ms 708 KB Output is correct
15 Correct 8 ms 724 KB Output is correct
16 Correct 1 ms 712 KB Output is correct
17 Correct 348 ms 800 KB Output is correct
18 Correct 137 ms 724 KB Output is correct
19 Correct 319 ms 808 KB Output is correct
20 Correct 623 ms 804 KB Output is correct
21 Correct 16 ms 724 KB Output is correct
22 Correct 12 ms 828 KB Output is correct
23 Correct 1 ms 724 KB Output is correct
24 Incorrect 1041 ms 800 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 804 KB Output is correct
4 Correct 8 ms 724 KB Output is correct
5 Correct 0 ms 724 KB Output is correct
6 Correct 350 ms 724 KB Output is correct
7 Correct 135 ms 808 KB Output is correct
8 Correct 329 ms 804 KB Output is correct
9 Correct 613 ms 804 KB Output is correct
10 Correct 16 ms 724 KB Output is correct
11 Correct 12 ms 812 KB Output is correct
12 Correct 9 ms 724 KB Output is correct
13 Incorrect 1 ms 724 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 804 KB Output is correct
4 Correct 8 ms 724 KB Output is correct
5 Correct 0 ms 724 KB Output is correct
6 Correct 350 ms 724 KB Output is correct
7 Correct 135 ms 808 KB Output is correct
8 Correct 329 ms 804 KB Output is correct
9 Correct 613 ms 804 KB Output is correct
10 Correct 16 ms 724 KB Output is correct
11 Correct 12 ms 812 KB Output is correct
12 Correct 2 ms 724 KB Output is correct
13 Correct 3 ms 724 KB Output is correct
14 Correct 2 ms 708 KB Output is correct
15 Correct 8 ms 724 KB Output is correct
16 Correct 1 ms 712 KB Output is correct
17 Correct 348 ms 800 KB Output is correct
18 Correct 137 ms 724 KB Output is correct
19 Correct 319 ms 808 KB Output is correct
20 Correct 623 ms 804 KB Output is correct
21 Correct 16 ms 724 KB Output is correct
22 Correct 12 ms 828 KB Output is correct
23 Correct 1 ms 724 KB Output is correct
24 Incorrect 1041 ms 800 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 724 KB Output is correct
2 Incorrect 1 ms 724 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 724 KB Output is correct
2 Correct 1 ms 724 KB Output is correct
3 Correct 1 ms 804 KB Output is correct
4 Correct 8 ms 724 KB Output is correct
5 Correct 0 ms 724 KB Output is correct
6 Correct 350 ms 724 KB Output is correct
7 Correct 135 ms 808 KB Output is correct
8 Correct 329 ms 804 KB Output is correct
9 Correct 613 ms 804 KB Output is correct
10 Correct 16 ms 724 KB Output is correct
11 Correct 12 ms 812 KB Output is correct
12 Correct 2 ms 724 KB Output is correct
13 Correct 3 ms 724 KB Output is correct
14 Correct 2 ms 708 KB Output is correct
15 Correct 8 ms 724 KB Output is correct
16 Correct 1 ms 712 KB Output is correct
17 Correct 348 ms 800 KB Output is correct
18 Correct 137 ms 724 KB Output is correct
19 Correct 319 ms 808 KB Output is correct
20 Correct 623 ms 804 KB Output is correct
21 Correct 16 ms 724 KB Output is correct
22 Correct 12 ms 828 KB Output is correct
23 Correct 1 ms 724 KB Output is correct
24 Incorrect 1041 ms 800 KB Output isn't correct
25 Halted 0 ms 0 KB -