답안 #590657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590657 2022-07-06T08:16:16 Z tutis Uplifting Excursion (BOI22_vault) C++17
20 / 100
5000 ms 3156 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 + 2) / 2; 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";
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 31 ms 3028 KB Output is correct
3 Correct 18 ms 3028 KB Output is correct
4 Correct 23 ms 3136 KB Output is correct
5 Correct 34 ms 3092 KB Output is correct
6 Correct 13 ms 3028 KB Output is correct
7 Correct 12 ms 3028 KB Output is correct
8 Correct 13 ms 3028 KB Output is correct
9 Correct 20 ms 3028 KB Output is correct
10 Correct 23 ms 3140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 31 ms 3028 KB Output is correct
3 Correct 18 ms 3028 KB Output is correct
4 Correct 23 ms 3136 KB Output is correct
5 Correct 34 ms 3092 KB Output is correct
6 Correct 13 ms 3028 KB Output is correct
7 Correct 12 ms 3028 KB Output is correct
8 Correct 13 ms 3028 KB Output is correct
9 Correct 20 ms 3028 KB Output is correct
10 Correct 23 ms 3140 KB Output is correct
11 Incorrect 2 ms 3028 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 31 ms 3028 KB Output is correct
3 Correct 18 ms 3028 KB Output is correct
4 Correct 23 ms 3136 KB Output is correct
5 Correct 34 ms 3092 KB Output is correct
6 Correct 13 ms 3028 KB Output is correct
7 Correct 12 ms 3028 KB Output is correct
8 Correct 13 ms 3028 KB Output is correct
9 Correct 20 ms 3028 KB Output is correct
10 Correct 23 ms 3140 KB Output is correct
11 Correct 4 ms 3028 KB Output is correct
12 Correct 30 ms 3028 KB Output is correct
13 Correct 17 ms 3156 KB Output is correct
14 Correct 25 ms 3136 KB Output is correct
15 Correct 35 ms 3028 KB Output is correct
16 Correct 14 ms 3140 KB Output is correct
17 Correct 12 ms 3028 KB Output is correct
18 Correct 13 ms 3136 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 22 ms 3140 KB Output is correct
21 Correct 44 ms 3028 KB Output is correct
22 Correct 40 ms 3120 KB Output is correct
23 Correct 323 ms 3116 KB Output is correct
24 Correct 159 ms 3028 KB Output is correct
25 Correct 287 ms 3116 KB Output is correct
26 Correct 222 ms 3120 KB Output is correct
27 Correct 61 ms 3028 KB Output is correct
28 Correct 230 ms 3124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 31 ms 3028 KB Output is correct
3 Correct 18 ms 3028 KB Output is correct
4 Correct 23 ms 3136 KB Output is correct
5 Correct 34 ms 3092 KB Output is correct
6 Correct 13 ms 3028 KB Output is correct
7 Correct 12 ms 3028 KB Output is correct
8 Correct 13 ms 3028 KB Output is correct
9 Correct 20 ms 3028 KB Output is correct
10 Correct 23 ms 3140 KB Output is correct
11 Correct 4 ms 3028 KB Output is correct
12 Correct 30 ms 3028 KB Output is correct
13 Correct 17 ms 3156 KB Output is correct
14 Correct 25 ms 3136 KB Output is correct
15 Correct 35 ms 3028 KB Output is correct
16 Correct 14 ms 3140 KB Output is correct
17 Correct 12 ms 3028 KB Output is correct
18 Correct 13 ms 3136 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 22 ms 3140 KB Output is correct
21 Correct 44 ms 3028 KB Output is correct
22 Correct 40 ms 3120 KB Output is correct
23 Correct 323 ms 3116 KB Output is correct
24 Correct 159 ms 3028 KB Output is correct
25 Correct 287 ms 3116 KB Output is correct
26 Correct 222 ms 3120 KB Output is correct
27 Correct 61 ms 3028 KB Output is correct
28 Correct 230 ms 3124 KB Output is correct
29 Correct 4 ms 3028 KB Output is correct
30 Correct 30 ms 3116 KB Output is correct
31 Correct 17 ms 3140 KB Output is correct
32 Correct 22 ms 3028 KB Output is correct
33 Correct 33 ms 3116 KB Output is correct
34 Correct 14 ms 3136 KB Output is correct
35 Correct 11 ms 3144 KB Output is correct
36 Correct 11 ms 3140 KB Output is correct
37 Correct 20 ms 3028 KB Output is correct
38 Correct 23 ms 3056 KB Output is correct
39 Correct 48 ms 3120 KB Output is correct
40 Correct 41 ms 3028 KB Output is correct
41 Correct 307 ms 3120 KB Output is correct
42 Correct 154 ms 3124 KB Output is correct
43 Correct 304 ms 3124 KB Output is correct
44 Correct 205 ms 3120 KB Output is correct
45 Correct 57 ms 3120 KB Output is correct
46 Correct 243 ms 3028 KB Output is correct
47 Correct 491 ms 3124 KB Output is correct
48 Correct 442 ms 3124 KB Output is correct
49 Execution timed out 5061 ms 3028 KB Time limit exceeded
50 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 3028 KB Output is correct
2 Correct 31 ms 3028 KB Output is correct
3 Correct 18 ms 3028 KB Output is correct
4 Correct 23 ms 3136 KB Output is correct
5 Correct 34 ms 3092 KB Output is correct
6 Correct 13 ms 3028 KB Output is correct
7 Correct 12 ms 3028 KB Output is correct
8 Correct 13 ms 3028 KB Output is correct
9 Correct 20 ms 3028 KB Output is correct
10 Correct 23 ms 3140 KB Output is correct
11 Correct 4 ms 3028 KB Output is correct
12 Correct 30 ms 3028 KB Output is correct
13 Correct 17 ms 3156 KB Output is correct
14 Correct 25 ms 3136 KB Output is correct
15 Correct 35 ms 3028 KB Output is correct
16 Correct 14 ms 3140 KB Output is correct
17 Correct 12 ms 3028 KB Output is correct
18 Correct 13 ms 3136 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 22 ms 3140 KB Output is correct
21 Correct 44 ms 3028 KB Output is correct
22 Correct 40 ms 3120 KB Output is correct
23 Correct 323 ms 3116 KB Output is correct
24 Correct 159 ms 3028 KB Output is correct
25 Correct 287 ms 3116 KB Output is correct
26 Correct 222 ms 3120 KB Output is correct
27 Correct 61 ms 3028 KB Output is correct
28 Correct 230 ms 3124 KB Output is correct
29 Correct 4 ms 3028 KB Output is correct
30 Correct 30 ms 3116 KB Output is correct
31 Correct 17 ms 3140 KB Output is correct
32 Correct 22 ms 3028 KB Output is correct
33 Correct 33 ms 3116 KB Output is correct
34 Correct 14 ms 3136 KB Output is correct
35 Correct 11 ms 3144 KB Output is correct
36 Correct 11 ms 3140 KB Output is correct
37 Correct 20 ms 3028 KB Output is correct
38 Correct 23 ms 3056 KB Output is correct
39 Correct 48 ms 3120 KB Output is correct
40 Correct 41 ms 3028 KB Output is correct
41 Correct 307 ms 3120 KB Output is correct
42 Correct 154 ms 3124 KB Output is correct
43 Correct 304 ms 3124 KB Output is correct
44 Correct 205 ms 3120 KB Output is correct
45 Correct 57 ms 3120 KB Output is correct
46 Correct 243 ms 3028 KB Output is correct
47 Correct 491 ms 3124 KB Output is correct
48 Correct 442 ms 3124 KB Output is correct
49 Execution timed out 5061 ms 3028 KB Time limit exceeded
50 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3028 KB Output isn't correct
2 Halted 0 ms 0 KB -