Submission #590620

# Submission time Handle Problem Language Result Execution time Memory
590620 2022-07-06T07:37:28 Z tutis Uplifting Excursion (BOI22_vault) C++17
0 / 100
2 ms 4180 KB
/*input
2 5
2 3 1 1 4
*/

#pragma GCC optimize ("O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using oset = tree<T,  null_type,  less<T>,  rb_tree_tag,  tree_order_statistics_node_update>;

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;
	int del = 0;
	for (int i = M; i >= 1; i--)
	{
		for (int k = 1; k <= A[i + M]; k++)
		{
			for (int j = min(D + del, 2 * D - i); j >= max(0, D - del); j--)
			{
				C[j + i] = C[j] + 1;
				//C[j + i] = max(C[j + i], C[j] + 1);
			}
			del += i;
		}
		for (int k = 1; k <= A[-i + M]; k++)
		{
			for (int j = max(D - del, i); j <= min(D + del, 2 * D); j++)
			{
				//C[j - i] = C[j] + 1;
				//C[j - i] = max(C[j - i], C[j] + 1);
			}
			if (k > A[i + M])
				del += i;
		}
	}
	if (L + D >= 0 && L + D <= 2 * D && C[L + D] >= 0)
		cout << C[L + D] + A[M] << "\n";
	else
		cout << "impossible\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 4180 KB Output isn't correct
2 Halted 0 ms 0 KB -