답안 #590383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590383 2022-07-05T22:00:01 Z tutis Uplifting Excursion (BOI22_vault) C++17
5 / 100
5000 ms 4224 KB
/*input
2 5
2 3 1 1 4
*/
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int M;
	ll L;
	cin >> M >> L;
	ll A[2 * M + 1];
	for (int i = 0; i <= 2 * M; i++)
		cin >> A[i];
	int D = 505500;
	vector<int> C(2 * D + 1, -1e9);
	C[D] = 0;
	for (int i = 1; i <= M; i++)
	{
		for (int k = 1; k <= A[i + M]; k++)
		{
			for (int j = 2 * D - i; j >= 0; j--)
			{
				C[j + i] = max(C[j + i], C[j] + 1);
			}
		}
		for (int k = 1; k <= A[-i + M]; k++)
		{
			for (int j = i; j <= 2 * D; j++)
			{
				C[j - i] = max(C[j - i], C[j] + 1);
			}
		}
	}
	if (L + D >= 0 && L + D <= 2 * D && C[L + D] >= 0)
		cout << C[L + D] + A[M] << "\n";
	else
		cout << "impossible\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4180 KB Output is correct
2 Correct 7 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 46 ms 4180 KB Output is correct
5 Correct 2024 ms 4180 KB Output is correct
6 Correct 2217 ms 4180 KB Output is correct
7 Correct 880 ms 4180 KB Output is correct
8 Correct 2100 ms 4180 KB Output is correct
9 Correct 3859 ms 4180 KB Output is correct
10 Correct 80 ms 4180 KB Output is correct
11 Correct 76 ms 4224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4180 KB Output is correct
2 Correct 7 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 46 ms 4180 KB Output is correct
5 Correct 2024 ms 4180 KB Output is correct
6 Correct 2217 ms 4180 KB Output is correct
7 Correct 880 ms 4180 KB Output is correct
8 Correct 2100 ms 4180 KB Output is correct
9 Correct 3859 ms 4180 KB Output is correct
10 Correct 80 ms 4180 KB Output is correct
11 Correct 76 ms 4224 KB Output is correct
12 Correct 12 ms 4180 KB Output is correct
13 Correct 7 ms 4180 KB Output is correct
14 Correct 7 ms 4180 KB Output is correct
15 Correct 54 ms 4180 KB Output is correct
16 Correct 2041 ms 4180 KB Output is correct
17 Correct 2148 ms 4180 KB Output is correct
18 Correct 858 ms 4180 KB Output is correct
19 Correct 2045 ms 4180 KB Output is correct
20 Correct 3874 ms 4180 KB Output is correct
21 Correct 85 ms 4180 KB Output is correct
22 Correct 74 ms 4180 KB Output is correct
23 Execution timed out 5063 ms 4180 KB Time limit exceeded
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4180 KB Output is correct
2 Execution timed out 5029 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4180 KB Output is correct
2 Execution timed out 5029 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4180 KB Output is correct
2 Execution timed out 5029 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4180 KB Output is correct
2 Correct 7 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 46 ms 4180 KB Output is correct
5 Correct 2024 ms 4180 KB Output is correct
6 Correct 2217 ms 4180 KB Output is correct
7 Correct 880 ms 4180 KB Output is correct
8 Correct 2100 ms 4180 KB Output is correct
9 Correct 3859 ms 4180 KB Output is correct
10 Correct 80 ms 4180 KB Output is correct
11 Correct 76 ms 4224 KB Output is correct
12 Correct 48 ms 4180 KB Output is correct
13 Execution timed out 5029 ms 4180 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4180 KB Output is correct
2 Execution timed out 5029 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4180 KB Output is correct
2 Correct 7 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 46 ms 4180 KB Output is correct
5 Correct 2024 ms 4180 KB Output is correct
6 Correct 2217 ms 4180 KB Output is correct
7 Correct 880 ms 4180 KB Output is correct
8 Correct 2100 ms 4180 KB Output is correct
9 Correct 3859 ms 4180 KB Output is correct
10 Correct 80 ms 4180 KB Output is correct
11 Correct 76 ms 4224 KB Output is correct
12 Correct 12 ms 4180 KB Output is correct
13 Correct 7 ms 4180 KB Output is correct
14 Correct 7 ms 4180 KB Output is correct
15 Correct 54 ms 4180 KB Output is correct
16 Correct 2041 ms 4180 KB Output is correct
17 Correct 2148 ms 4180 KB Output is correct
18 Correct 858 ms 4180 KB Output is correct
19 Correct 2045 ms 4180 KB Output is correct
20 Correct 3874 ms 4180 KB Output is correct
21 Correct 85 ms 4180 KB Output is correct
22 Correct 74 ms 4180 KB Output is correct
23 Execution timed out 5063 ms 4180 KB Time limit exceeded
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4180 KB Output is correct
2 Execution timed out 5029 ms 4180 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4180 KB Output is correct
2 Correct 7 ms 4180 KB Output is correct
3 Correct 8 ms 4180 KB Output is correct
4 Correct 46 ms 4180 KB Output is correct
5 Correct 2024 ms 4180 KB Output is correct
6 Correct 2217 ms 4180 KB Output is correct
7 Correct 880 ms 4180 KB Output is correct
8 Correct 2100 ms 4180 KB Output is correct
9 Correct 3859 ms 4180 KB Output is correct
10 Correct 80 ms 4180 KB Output is correct
11 Correct 76 ms 4224 KB Output is correct
12 Correct 12 ms 4180 KB Output is correct
13 Correct 7 ms 4180 KB Output is correct
14 Correct 7 ms 4180 KB Output is correct
15 Correct 54 ms 4180 KB Output is correct
16 Correct 2041 ms 4180 KB Output is correct
17 Correct 2148 ms 4180 KB Output is correct
18 Correct 858 ms 4180 KB Output is correct
19 Correct 2045 ms 4180 KB Output is correct
20 Correct 3874 ms 4180 KB Output is correct
21 Correct 85 ms 4180 KB Output is correct
22 Correct 74 ms 4180 KB Output is correct
23 Execution timed out 5063 ms 4180 KB Time limit exceeded
24 Halted 0 ms 0 KB -