Submission #590655

# Submission time Handle Problem Language Result Execution time Memory
590655 2022-07-06T08:14:01 Z tutis Uplifting Excursion (BOI22_vault) C++17
20 / 100
5000 ms 3148 KB
/*input
1 5
0 0 6

*/

#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];
	array<array<pair<ll, ll>, 300>, 301> v;
	for (int m = 1; m <= M; m++)
	{
		for (int k = 0; k < m; k++)
			v[m][k] = { -3e18, -3e18};
		v[m][0] = {0, 0};
	}
	ll ret = -1;
	for (ll i = 1; i <= M; i++)
	{
		auto w = v;
		for (ll m = M / 2 + 1; m <= M; m++)
			for (ll k = 0; k < m; k++)
			{
				ll x = v[m][k].first;
				ll mx = (L - x) / i;
				mx = min(mx, A[i + M]);
				for (ll c = mx; c >= 0 && c >= mx - M; c--)
				{
					ll val = x + i * c;
					ll cnt = v[m][k].second + c;
					for (ll md = M / 2 + 1; md <= M; md++)
					{
						ll vv = val % md;
						w[md][vv] = max(w[md][vv], {val, cnt});
					}
				}
			}
		v = w;
	}
	for (int m = 1; m <= M; m++)
		for (int k = 0; k < m; k++)
			if (v[m][k].first == L)
				ret = max(ret, v[m][k].second);
	if (ret < 0)
		cout << "impossible\n";
	else
		cout << ret + A[M] << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3136 KB Output is correct
2 Correct 43 ms 3120 KB Output is correct
3 Correct 20 ms 3116 KB Output is correct
4 Correct 31 ms 3120 KB Output is correct
5 Correct 51 ms 3124 KB Output is correct
6 Correct 16 ms 3028 KB Output is correct
7 Correct 13 ms 3028 KB Output is correct
8 Correct 12 ms 3028 KB Output is correct
9 Correct 25 ms 3120 KB Output is correct
10 Correct 32 ms 3028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3136 KB Output is correct
2 Correct 43 ms 3120 KB Output is correct
3 Correct 20 ms 3116 KB Output is correct
4 Correct 31 ms 3120 KB Output is correct
5 Correct 51 ms 3124 KB Output is correct
6 Correct 16 ms 3028 KB Output is correct
7 Correct 13 ms 3028 KB Output is correct
8 Correct 12 ms 3028 KB Output is correct
9 Correct 25 ms 3120 KB Output is correct
10 Correct 32 ms 3028 KB Output is correct
11 Incorrect 2 ms 3028 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3136 KB Output is correct
2 Correct 43 ms 3120 KB Output is correct
3 Correct 20 ms 3116 KB Output is correct
4 Correct 31 ms 3120 KB Output is correct
5 Correct 51 ms 3124 KB Output is correct
6 Correct 16 ms 3028 KB Output is correct
7 Correct 13 ms 3028 KB Output is correct
8 Correct 12 ms 3028 KB Output is correct
9 Correct 25 ms 3120 KB Output is correct
10 Correct 32 ms 3028 KB Output is correct
11 Correct 3 ms 3028 KB Output is correct
12 Correct 43 ms 3028 KB Output is correct
13 Correct 21 ms 3132 KB Output is correct
14 Correct 31 ms 3120 KB Output is correct
15 Correct 52 ms 3028 KB Output is correct
16 Correct 15 ms 3028 KB Output is correct
17 Correct 14 ms 3144 KB Output is correct
18 Correct 14 ms 3140 KB Output is correct
19 Correct 25 ms 3028 KB Output is correct
20 Correct 30 ms 3028 KB Output is correct
21 Correct 56 ms 3028 KB Output is correct
22 Correct 39 ms 3028 KB Output is correct
23 Correct 416 ms 3148 KB Output is correct
24 Correct 246 ms 3120 KB Output is correct
25 Correct 434 ms 3116 KB Output is correct
26 Correct 348 ms 3120 KB Output is correct
27 Correct 75 ms 3116 KB Output is correct
28 Correct 390 ms 3124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3136 KB Output is correct
2 Correct 43 ms 3120 KB Output is correct
3 Correct 20 ms 3116 KB Output is correct
4 Correct 31 ms 3120 KB Output is correct
5 Correct 51 ms 3124 KB Output is correct
6 Correct 16 ms 3028 KB Output is correct
7 Correct 13 ms 3028 KB Output is correct
8 Correct 12 ms 3028 KB Output is correct
9 Correct 25 ms 3120 KB Output is correct
10 Correct 32 ms 3028 KB Output is correct
11 Correct 3 ms 3028 KB Output is correct
12 Correct 43 ms 3028 KB Output is correct
13 Correct 21 ms 3132 KB Output is correct
14 Correct 31 ms 3120 KB Output is correct
15 Correct 52 ms 3028 KB Output is correct
16 Correct 15 ms 3028 KB Output is correct
17 Correct 14 ms 3144 KB Output is correct
18 Correct 14 ms 3140 KB Output is correct
19 Correct 25 ms 3028 KB Output is correct
20 Correct 30 ms 3028 KB Output is correct
21 Correct 56 ms 3028 KB Output is correct
22 Correct 39 ms 3028 KB Output is correct
23 Correct 416 ms 3148 KB Output is correct
24 Correct 246 ms 3120 KB Output is correct
25 Correct 434 ms 3116 KB Output is correct
26 Correct 348 ms 3120 KB Output is correct
27 Correct 75 ms 3116 KB Output is correct
28 Correct 390 ms 3124 KB Output is correct
29 Correct 4 ms 3028 KB Output is correct
30 Correct 43 ms 3028 KB Output is correct
31 Correct 23 ms 3028 KB Output is correct
32 Correct 33 ms 3076 KB Output is correct
33 Correct 59 ms 3120 KB Output is correct
34 Correct 15 ms 3140 KB Output is correct
35 Correct 15 ms 3136 KB Output is correct
36 Correct 11 ms 3028 KB Output is correct
37 Correct 22 ms 3028 KB Output is correct
38 Correct 30 ms 3120 KB Output is correct
39 Correct 56 ms 3120 KB Output is correct
40 Correct 40 ms 3028 KB Output is correct
41 Correct 441 ms 3120 KB Output is correct
42 Correct 238 ms 3120 KB Output is correct
43 Correct 448 ms 3124 KB Output is correct
44 Correct 343 ms 3028 KB Output is correct
45 Correct 71 ms 3128 KB Output is correct
46 Correct 398 ms 3124 KB Output is correct
47 Correct 668 ms 3124 KB Output is correct
48 Correct 496 ms 3120 KB Output is correct
49 Execution timed out 5050 ms 3028 KB Time limit exceeded
50 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3136 KB Output is correct
2 Correct 43 ms 3120 KB Output is correct
3 Correct 20 ms 3116 KB Output is correct
4 Correct 31 ms 3120 KB Output is correct
5 Correct 51 ms 3124 KB Output is correct
6 Correct 16 ms 3028 KB Output is correct
7 Correct 13 ms 3028 KB Output is correct
8 Correct 12 ms 3028 KB Output is correct
9 Correct 25 ms 3120 KB Output is correct
10 Correct 32 ms 3028 KB Output is correct
11 Correct 3 ms 3028 KB Output is correct
12 Correct 43 ms 3028 KB Output is correct
13 Correct 21 ms 3132 KB Output is correct
14 Correct 31 ms 3120 KB Output is correct
15 Correct 52 ms 3028 KB Output is correct
16 Correct 15 ms 3028 KB Output is correct
17 Correct 14 ms 3144 KB Output is correct
18 Correct 14 ms 3140 KB Output is correct
19 Correct 25 ms 3028 KB Output is correct
20 Correct 30 ms 3028 KB Output is correct
21 Correct 56 ms 3028 KB Output is correct
22 Correct 39 ms 3028 KB Output is correct
23 Correct 416 ms 3148 KB Output is correct
24 Correct 246 ms 3120 KB Output is correct
25 Correct 434 ms 3116 KB Output is correct
26 Correct 348 ms 3120 KB Output is correct
27 Correct 75 ms 3116 KB Output is correct
28 Correct 390 ms 3124 KB Output is correct
29 Correct 4 ms 3028 KB Output is correct
30 Correct 43 ms 3028 KB Output is correct
31 Correct 23 ms 3028 KB Output is correct
32 Correct 33 ms 3076 KB Output is correct
33 Correct 59 ms 3120 KB Output is correct
34 Correct 15 ms 3140 KB Output is correct
35 Correct 15 ms 3136 KB Output is correct
36 Correct 11 ms 3028 KB Output is correct
37 Correct 22 ms 3028 KB Output is correct
38 Correct 30 ms 3120 KB Output is correct
39 Correct 56 ms 3120 KB Output is correct
40 Correct 40 ms 3028 KB Output is correct
41 Correct 441 ms 3120 KB Output is correct
42 Correct 238 ms 3120 KB Output is correct
43 Correct 448 ms 3124 KB Output is correct
44 Correct 343 ms 3028 KB Output is correct
45 Correct 71 ms 3128 KB Output is correct
46 Correct 398 ms 3124 KB Output is correct
47 Correct 668 ms 3124 KB Output is correct
48 Correct 496 ms 3120 KB Output is correct
49 Execution timed out 5050 ms 3028 KB Time limit exceeded
50 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -