답안 #829346

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829346 2023-08-18T09:36:13 Z QwertyPi Uplifting Excursion (BOI22_vault) C++14
40 / 100
2025 ms 228204 KB
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#define int long long

using namespace std;

const int M = 300 + 11;
const int X = M * M;
const int INF = 1LL << 60;
int a[M * 2];
int s[M * 2];
int dp[M * 2][X];

int norm(int x, int m){
	if(x >= 0) return x;
	return (x % m + m) % m;
}

int32_t main(){
	int m, L; cin >> m >> L;
	for(int i = 0; i <= m * 2; i++) cin >> a[i];
	
	int ans = a[m];
	for(int i = m + 1; i <= m * 2; i++) s[i] = min(L, s[i - 1] + (i - m) * a[i]);

	for(int i = m; i <= m * 2; i++)
		fill(dp[i], dp[i] + X, -INF);

	dp[m][0] = 0;
	for(int i = m + 1; i <= m * 2; i++){
		for(int j = 0; j <= m * (i - 1 - m); j++){
			int left = norm(s[i] - s[i - 1] + j - a[i] * (i - m), i - m);
			int right = min(s[i] + j - s[i - 1], m * (i - m));
			int inc = i - m;
			int delta = ((s[i] - left) - (s[i - 1] - j)) / (i - m);
			for(int k = left; k <= right; k += inc){
				dp[i][k] = max(dp[i][k], dp[i - 1][j] + delta);
				delta--;
			}
		}
	}

	if(s[m * 2] < L || L < 0){
		cout << "impossible" << endl;
		return 0;
	}
	if(dp[m * 2][0] < 0){
		cout << "impossible" << endl;
	}else{
		cout << ans + dp[m * 2][0] << endl;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8596 KB Output is correct
2 Correct 10 ms 23892 KB Output is correct
3 Correct 9 ms 23764 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 10 ms 23764 KB Output is correct
6 Correct 10 ms 23760 KB Output is correct
7 Correct 9 ms 23788 KB Output is correct
8 Correct 9 ms 23764 KB Output is correct
9 Correct 9 ms 23760 KB Output is correct
10 Correct 9 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8596 KB Output is correct
2 Correct 10 ms 23892 KB Output is correct
3 Correct 9 ms 23764 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 10 ms 23764 KB Output is correct
6 Correct 10 ms 23760 KB Output is correct
7 Correct 9 ms 23788 KB Output is correct
8 Correct 9 ms 23764 KB Output is correct
9 Correct 9 ms 23760 KB Output is correct
10 Correct 9 ms 23764 KB Output is correct
11 Incorrect 1 ms 2516 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8596 KB Output is correct
2 Correct 10 ms 23892 KB Output is correct
3 Correct 9 ms 23764 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 10 ms 23764 KB Output is correct
6 Correct 10 ms 23760 KB Output is correct
7 Correct 9 ms 23788 KB Output is correct
8 Correct 9 ms 23764 KB Output is correct
9 Correct 9 ms 23760 KB Output is correct
10 Correct 9 ms 23764 KB Output is correct
11 Correct 3 ms 8660 KB Output is correct
12 Correct 9 ms 23764 KB Output is correct
13 Correct 9 ms 23764 KB Output is correct
14 Correct 9 ms 23684 KB Output is correct
15 Correct 10 ms 23772 KB Output is correct
16 Correct 10 ms 23724 KB Output is correct
17 Correct 9 ms 23760 KB Output is correct
18 Correct 11 ms 23764 KB Output is correct
19 Correct 9 ms 23764 KB Output is correct
20 Correct 12 ms 23768 KB Output is correct
21 Correct 14 ms 38900 KB Output is correct
22 Correct 15 ms 38864 KB Output is correct
23 Correct 16 ms 38868 KB Output is correct
24 Correct 15 ms 38896 KB Output is correct
25 Correct 16 ms 38872 KB Output is correct
26 Correct 18 ms 38936 KB Output is correct
27 Correct 17 ms 38868 KB Output is correct
28 Correct 19 ms 38868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8596 KB Output is correct
2 Correct 10 ms 23892 KB Output is correct
3 Correct 9 ms 23764 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 10 ms 23764 KB Output is correct
6 Correct 10 ms 23760 KB Output is correct
7 Correct 9 ms 23788 KB Output is correct
8 Correct 9 ms 23764 KB Output is correct
9 Correct 9 ms 23760 KB Output is correct
10 Correct 9 ms 23764 KB Output is correct
11 Correct 3 ms 8660 KB Output is correct
12 Correct 9 ms 23764 KB Output is correct
13 Correct 9 ms 23764 KB Output is correct
14 Correct 9 ms 23684 KB Output is correct
15 Correct 10 ms 23772 KB Output is correct
16 Correct 10 ms 23724 KB Output is correct
17 Correct 9 ms 23760 KB Output is correct
18 Correct 11 ms 23764 KB Output is correct
19 Correct 9 ms 23764 KB Output is correct
20 Correct 12 ms 23768 KB Output is correct
21 Correct 14 ms 38900 KB Output is correct
22 Correct 15 ms 38864 KB Output is correct
23 Correct 16 ms 38868 KB Output is correct
24 Correct 15 ms 38896 KB Output is correct
25 Correct 16 ms 38872 KB Output is correct
26 Correct 18 ms 38936 KB Output is correct
27 Correct 17 ms 38868 KB Output is correct
28 Correct 19 ms 38868 KB Output is correct
29 Correct 4 ms 8560 KB Output is correct
30 Correct 10 ms 23764 KB Output is correct
31 Correct 10 ms 23784 KB Output is correct
32 Correct 9 ms 23764 KB Output is correct
33 Correct 9 ms 23764 KB Output is correct
34 Correct 11 ms 23892 KB Output is correct
35 Correct 9 ms 23764 KB Output is correct
36 Correct 10 ms 23744 KB Output is correct
37 Correct 9 ms 23688 KB Output is correct
38 Correct 9 ms 23768 KB Output is correct
39 Correct 15 ms 38904 KB Output is correct
40 Correct 18 ms 38916 KB Output is correct
41 Correct 16 ms 38856 KB Output is correct
42 Correct 16 ms 38868 KB Output is correct
43 Correct 17 ms 38868 KB Output is correct
44 Correct 17 ms 38824 KB Output is correct
45 Correct 17 ms 38860 KB Output is correct
46 Correct 16 ms 38868 KB Output is correct
47 Correct 32 ms 76760 KB Output is correct
48 Correct 32 ms 76756 KB Output is correct
49 Correct 50 ms 76820 KB Output is correct
50 Correct 43 ms 76748 KB Output is correct
51 Correct 50 ms 76740 KB Output is correct
52 Correct 54 ms 76772 KB Output is correct
53 Correct 48 ms 76748 KB Output is correct
54 Correct 42 ms 76680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8596 KB Output is correct
2 Correct 10 ms 23892 KB Output is correct
3 Correct 9 ms 23764 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 10 ms 23764 KB Output is correct
6 Correct 10 ms 23760 KB Output is correct
7 Correct 9 ms 23788 KB Output is correct
8 Correct 9 ms 23764 KB Output is correct
9 Correct 9 ms 23760 KB Output is correct
10 Correct 9 ms 23764 KB Output is correct
11 Correct 3 ms 8660 KB Output is correct
12 Correct 9 ms 23764 KB Output is correct
13 Correct 9 ms 23764 KB Output is correct
14 Correct 9 ms 23684 KB Output is correct
15 Correct 10 ms 23772 KB Output is correct
16 Correct 10 ms 23724 KB Output is correct
17 Correct 9 ms 23760 KB Output is correct
18 Correct 11 ms 23764 KB Output is correct
19 Correct 9 ms 23764 KB Output is correct
20 Correct 12 ms 23768 KB Output is correct
21 Correct 14 ms 38900 KB Output is correct
22 Correct 15 ms 38864 KB Output is correct
23 Correct 16 ms 38868 KB Output is correct
24 Correct 15 ms 38896 KB Output is correct
25 Correct 16 ms 38872 KB Output is correct
26 Correct 18 ms 38936 KB Output is correct
27 Correct 17 ms 38868 KB Output is correct
28 Correct 19 ms 38868 KB Output is correct
29 Correct 4 ms 8560 KB Output is correct
30 Correct 10 ms 23764 KB Output is correct
31 Correct 10 ms 23784 KB Output is correct
32 Correct 9 ms 23764 KB Output is correct
33 Correct 9 ms 23764 KB Output is correct
34 Correct 11 ms 23892 KB Output is correct
35 Correct 9 ms 23764 KB Output is correct
36 Correct 10 ms 23744 KB Output is correct
37 Correct 9 ms 23688 KB Output is correct
38 Correct 9 ms 23768 KB Output is correct
39 Correct 15 ms 38904 KB Output is correct
40 Correct 18 ms 38916 KB Output is correct
41 Correct 16 ms 38856 KB Output is correct
42 Correct 16 ms 38868 KB Output is correct
43 Correct 17 ms 38868 KB Output is correct
44 Correct 17 ms 38824 KB Output is correct
45 Correct 17 ms 38860 KB Output is correct
46 Correct 16 ms 38868 KB Output is correct
47 Correct 32 ms 76760 KB Output is correct
48 Correct 32 ms 76756 KB Output is correct
49 Correct 50 ms 76820 KB Output is correct
50 Correct 43 ms 76748 KB Output is correct
51 Correct 50 ms 76740 KB Output is correct
52 Correct 54 ms 76772 KB Output is correct
53 Correct 48 ms 76748 KB Output is correct
54 Correct 42 ms 76680 KB Output is correct
55 Correct 3 ms 8532 KB Output is correct
56 Correct 10 ms 23764 KB Output is correct
57 Correct 10 ms 23764 KB Output is correct
58 Correct 10 ms 23824 KB Output is correct
59 Correct 10 ms 23764 KB Output is correct
60 Correct 10 ms 23748 KB Output is correct
61 Correct 9 ms 23764 KB Output is correct
62 Correct 9 ms 23764 KB Output is correct
63 Correct 10 ms 23764 KB Output is correct
64 Correct 10 ms 23764 KB Output is correct
65 Correct 15 ms 38868 KB Output is correct
66 Correct 16 ms 38868 KB Output is correct
67 Correct 17 ms 38880 KB Output is correct
68 Correct 16 ms 38860 KB Output is correct
69 Correct 16 ms 38868 KB Output is correct
70 Correct 18 ms 38932 KB Output is correct
71 Correct 18 ms 38892 KB Output is correct
72 Correct 16 ms 38868 KB Output is correct
73 Correct 32 ms 76684 KB Output is correct
74 Correct 32 ms 76688 KB Output is correct
75 Correct 56 ms 76852 KB Output is correct
76 Correct 40 ms 76728 KB Output is correct
77 Correct 51 ms 76768 KB Output is correct
78 Correct 53 ms 76772 KB Output is correct
79 Correct 50 ms 76684 KB Output is correct
80 Correct 43 ms 76716 KB Output is correct
81 Correct 1609 ms 228196 KB Output is correct
82 Correct 748 ms 228200 KB Output is correct
83 Correct 1463 ms 228204 KB Output is correct
84 Correct 2025 ms 228200 KB Output is correct
85 Correct 177 ms 228148 KB Output is correct
86 Correct 167 ms 228196 KB Output is correct
87 Correct 1145 ms 228200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -