답안 #867685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867685 2023-10-29T07:23:33 Z TAhmed33 Uplifting Excursion (BOI22_vault) C++
0 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll bad = -1e17;
map <ll, ll> dp[202];
ll n, arr[202], l;
ll ans (ll pos, ll cur) {
	if (pos == -n - 1) return (cur == l ? 0ll : bad);
	if (dp[pos + n].count(cur)) return dp[pos + n][cur];
	if (pos == -n - 1) {
		return dp[pos + n][cur] = (cur == l ? 0ll : bad);
	}
	ll ret = ans(pos - 1, cur);
	for (int i = 1; i <= arr[pos + n]; i++) {
		ret = max(ret, i + ans(pos - 1, cur + pos * i));
	}
	return dp[pos + n][cur] = ret;
}
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 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 5085 ms 75224 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 5085 ms 75224 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 2682 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 2682 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 2682 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 5085 ms 75224 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 2682 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 5085 ms 75224 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Runtime error 2682 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 5085 ms 75224 KB Time limit exceeded
6 Halted 0 ms 0 KB -