답안 #701336

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
701336 2023-02-21T01:21:32 Z angelo_torres Uplifting Excursion (BOI22_vault) C++17
0 / 100
10 ms 1364 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(dp[l+N] < 0){
		cout << "impossible\n";
	}else{
		cout << dp[l+N] << "\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 720 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 9 ms 708 KB Output is correct
5 Runtime error 1 ms 1364 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 720 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 9 ms 708 KB Output is correct
5 Runtime error 1 ms 1364 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 724 KB Output is correct
2 Runtime error 1 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 724 KB Output is correct
2 Runtime error 1 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 724 KB Output is correct
2 Runtime error 1 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 720 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 9 ms 708 KB Output is correct
5 Runtime error 1 ms 1364 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 724 KB Output is correct
2 Runtime error 1 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 720 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 9 ms 708 KB Output is correct
5 Runtime error 1 ms 1364 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 724 KB Output is correct
2 Runtime error 1 ms 1364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 720 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 724 KB Output is correct
4 Correct 9 ms 708 KB Output is correct
5 Runtime error 1 ms 1364 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -