답안 #867683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867683 2023-10-29T07:17:29 Z TAhmed33 Uplifting Excursion (BOI22_vault) C++
0 / 100
5000 ms 401188 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll bad = -1e17;
map <pair <ll, ll>, ll> dp;
ll n, arr[250], l;
ll ans (ll pos, ll cur) {
	if (dp.count({pos, cur})) return dp[{pos, cur}];
	if (pos == -n - 1) {
		return dp[{pos, cur}] = (cur == l ? 0ll : bad);
	}
	dp[{pos, cur}] = ans(pos - 1, cur);
	for (int i = 1; i <= arr[pos + n]; i++) {
		dp[{pos, cur}] = max(dp[{pos, cur}], i + ans(pos - 1, cur + pos * i));
	}
	return dp[{pos, cur}];
}
int main () {
	cin >> n >> l;
	for (int i = -n; i <= n; i++) cin >> arr[i + n];
	ll z = ans(n, 0);
	if (z < 0) {
		cout << "impossible\n";
	} else {
		cout << z << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Execution timed out 5084 ms 41476 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Execution timed out 5084 ms 41476 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Execution timed out 5084 ms 401188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Execution timed out 5084 ms 401188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Execution timed out 5084 ms 401188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Execution timed out 5084 ms 41476 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Execution timed out 5084 ms 401188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Execution timed out 5084 ms 41476 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Execution timed out 5084 ms 401188 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Execution timed out 5084 ms 41476 KB Time limit exceeded
6 Halted 0 ms 0 KB -