Submission #590362

# Submission time Handle Problem Language Result Execution time Memory
590362 2022-07-05T21:29:54 Z tutis Uplifting Excursion (BOI22_vault) C++17
0 / 100
479 ms 472 KB
/*input
1 5
0 0 6

*/
#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 = 2500;
	vector<ll> C(2 * D + 1, -1e18);
	C[D] = 0;
	for (int i = -M; i <= M; i++)
	{
		if (i < 0)
		{
			for (int k = 1; k <= A[i + M]; k++)
			{
				for (int j = 2 * D; j >= - k * i; j--)
				{
					C[j + k * i] = max(C[j + k * i], C[j] + k);
				}
			}
		}
		else if (i > 0)
		{
			for (int k = 1; k <= A[i + M]; k++)
			{
				for (int j = 0; j <= 2 * D - k * i; j++)
				{
					C[j + k * i] = max(C[j + k * i], C[j] + k);
				}
			}
		}
		else
		{
			for (int j = 0; j <= 2 * D; j++)
			{
				C[j] += A[i + M];
			}
		}
	}
	if (C[L + D] >= 0)
		cout << C[L + D] << "\n";
	else
		cout << "impossible\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 479 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 479 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 479 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 479 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 479 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -