답안 #829317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829317 2023-08-18T09:04:42 Z QwertyPi Uplifting Excursion (BOI22_vault) C++14
30 / 100
5000 ms 228172 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];

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 * m; j++){
			for(int k = ((s[i] - s[i - 1] + j) % (i - m) + (i - m)) % (i - m); k < m * m; k += (i - m)){
				int vj = s[i - 1] - j, vk = s[i] - k;
				if(vj > vk) break;
				if((vk - vj) / (i - m) > a[i]) continue;
				dp[i][k] = max(dp[i][k], dp[i - 1][j] + (vk - vj) / (i - m));
			}
		}
	}
	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 8532 KB Output is correct
2 Correct 28 ms 23748 KB Output is correct
3 Correct 19 ms 23792 KB Output is correct
4 Correct 27 ms 23764 KB Output is correct
5 Correct 25 ms 23796 KB Output is correct
6 Correct 26 ms 23664 KB Output is correct
7 Correct 18 ms 23740 KB Output is correct
8 Correct 18 ms 23796 KB Output is correct
9 Correct 27 ms 23796 KB Output is correct
10 Correct 23 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8532 KB Output is correct
2 Correct 28 ms 23748 KB Output is correct
3 Correct 19 ms 23792 KB Output is correct
4 Correct 27 ms 23764 KB Output is correct
5 Correct 25 ms 23796 KB Output is correct
6 Correct 26 ms 23664 KB Output is correct
7 Correct 18 ms 23740 KB Output is correct
8 Correct 18 ms 23796 KB Output is correct
9 Correct 27 ms 23796 KB Output is correct
10 Correct 23 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 8532 KB Output is correct
2 Correct 28 ms 23748 KB Output is correct
3 Correct 19 ms 23792 KB Output is correct
4 Correct 27 ms 23764 KB Output is correct
5 Correct 25 ms 23796 KB Output is correct
6 Correct 26 ms 23664 KB Output is correct
7 Correct 18 ms 23740 KB Output is correct
8 Correct 18 ms 23796 KB Output is correct
9 Correct 27 ms 23796 KB Output is correct
10 Correct 23 ms 23764 KB Output is correct
11 Correct 3 ms 8532 KB Output is correct
12 Correct 27 ms 23716 KB Output is correct
13 Correct 20 ms 23780 KB Output is correct
14 Correct 27 ms 23764 KB Output is correct
15 Correct 26 ms 23772 KB Output is correct
16 Correct 25 ms 23792 KB Output is correct
17 Correct 19 ms 23800 KB Output is correct
18 Correct 18 ms 23764 KB Output is correct
19 Correct 25 ms 23764 KB Output is correct
20 Correct 23 ms 23796 KB Output is correct
21 Correct 91 ms 38824 KB Output is correct
22 Correct 92 ms 38996 KB Output is correct
23 Correct 142 ms 38920 KB Output is correct
24 Correct 111 ms 38916 KB Output is correct
25 Correct 173 ms 38916 KB Output is correct
26 Correct 149 ms 38924 KB Output is correct
27 Correct 141 ms 38868 KB Output is correct
28 Correct 169 ms 38916 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 8532 KB Output is correct
2 Correct 28 ms 23748 KB Output is correct
3 Correct 19 ms 23792 KB Output is correct
4 Correct 27 ms 23764 KB Output is correct
5 Correct 25 ms 23796 KB Output is correct
6 Correct 26 ms 23664 KB Output is correct
7 Correct 18 ms 23740 KB Output is correct
8 Correct 18 ms 23796 KB Output is correct
9 Correct 27 ms 23796 KB Output is correct
10 Correct 23 ms 23764 KB Output is correct
11 Correct 3 ms 8532 KB Output is correct
12 Correct 27 ms 23716 KB Output is correct
13 Correct 20 ms 23780 KB Output is correct
14 Correct 27 ms 23764 KB Output is correct
15 Correct 26 ms 23772 KB Output is correct
16 Correct 25 ms 23792 KB Output is correct
17 Correct 19 ms 23800 KB Output is correct
18 Correct 18 ms 23764 KB Output is correct
19 Correct 25 ms 23764 KB Output is correct
20 Correct 23 ms 23796 KB Output is correct
21 Correct 91 ms 38824 KB Output is correct
22 Correct 92 ms 38996 KB Output is correct
23 Correct 142 ms 38920 KB Output is correct
24 Correct 111 ms 38916 KB Output is correct
25 Correct 173 ms 38916 KB Output is correct
26 Correct 149 ms 38924 KB Output is correct
27 Correct 141 ms 38868 KB Output is correct
28 Correct 169 ms 38916 KB Output is correct
29 Correct 3 ms 8532 KB Output is correct
30 Correct 28 ms 23780 KB Output is correct
31 Correct 19 ms 23800 KB Output is correct
32 Correct 30 ms 23892 KB Output is correct
33 Correct 25 ms 23788 KB Output is correct
34 Correct 26 ms 23764 KB Output is correct
35 Correct 20 ms 23756 KB Output is correct
36 Correct 19 ms 23796 KB Output is correct
37 Correct 26 ms 23764 KB Output is correct
38 Correct 22 ms 23764 KB Output is correct
39 Correct 90 ms 38920 KB Output is correct
40 Correct 91 ms 38920 KB Output is correct
41 Correct 143 ms 38916 KB Output is correct
42 Correct 112 ms 38924 KB Output is correct
43 Correct 174 ms 38924 KB Output is correct
44 Correct 148 ms 38868 KB Output is correct
45 Correct 143 ms 38988 KB Output is correct
46 Correct 169 ms 38924 KB Output is correct
47 Correct 1456 ms 76772 KB Output is correct
48 Correct 1462 ms 76772 KB Output is correct
49 Correct 3198 ms 76776 KB Output is correct
50 Correct 1699 ms 76776 KB Output is correct
51 Correct 3332 ms 76780 KB Output is correct
52 Correct 2826 ms 76772 KB Output is correct
53 Correct 2253 ms 76772 KB Output is correct
54 Correct 2990 ms 76772 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 8532 KB Output is correct
2 Correct 28 ms 23748 KB Output is correct
3 Correct 19 ms 23792 KB Output is correct
4 Correct 27 ms 23764 KB Output is correct
5 Correct 25 ms 23796 KB Output is correct
6 Correct 26 ms 23664 KB Output is correct
7 Correct 18 ms 23740 KB Output is correct
8 Correct 18 ms 23796 KB Output is correct
9 Correct 27 ms 23796 KB Output is correct
10 Correct 23 ms 23764 KB Output is correct
11 Correct 3 ms 8532 KB Output is correct
12 Correct 27 ms 23716 KB Output is correct
13 Correct 20 ms 23780 KB Output is correct
14 Correct 27 ms 23764 KB Output is correct
15 Correct 26 ms 23772 KB Output is correct
16 Correct 25 ms 23792 KB Output is correct
17 Correct 19 ms 23800 KB Output is correct
18 Correct 18 ms 23764 KB Output is correct
19 Correct 25 ms 23764 KB Output is correct
20 Correct 23 ms 23796 KB Output is correct
21 Correct 91 ms 38824 KB Output is correct
22 Correct 92 ms 38996 KB Output is correct
23 Correct 142 ms 38920 KB Output is correct
24 Correct 111 ms 38916 KB Output is correct
25 Correct 173 ms 38916 KB Output is correct
26 Correct 149 ms 38924 KB Output is correct
27 Correct 141 ms 38868 KB Output is correct
28 Correct 169 ms 38916 KB Output is correct
29 Correct 3 ms 8532 KB Output is correct
30 Correct 28 ms 23780 KB Output is correct
31 Correct 19 ms 23800 KB Output is correct
32 Correct 30 ms 23892 KB Output is correct
33 Correct 25 ms 23788 KB Output is correct
34 Correct 26 ms 23764 KB Output is correct
35 Correct 20 ms 23756 KB Output is correct
36 Correct 19 ms 23796 KB Output is correct
37 Correct 26 ms 23764 KB Output is correct
38 Correct 22 ms 23764 KB Output is correct
39 Correct 90 ms 38920 KB Output is correct
40 Correct 91 ms 38920 KB Output is correct
41 Correct 143 ms 38916 KB Output is correct
42 Correct 112 ms 38924 KB Output is correct
43 Correct 174 ms 38924 KB Output is correct
44 Correct 148 ms 38868 KB Output is correct
45 Correct 143 ms 38988 KB Output is correct
46 Correct 169 ms 38924 KB Output is correct
47 Correct 1456 ms 76772 KB Output is correct
48 Correct 1462 ms 76772 KB Output is correct
49 Correct 3198 ms 76776 KB Output is correct
50 Correct 1699 ms 76776 KB Output is correct
51 Correct 3332 ms 76780 KB Output is correct
52 Correct 2826 ms 76772 KB Output is correct
53 Correct 2253 ms 76772 KB Output is correct
54 Correct 2990 ms 76772 KB Output is correct
55 Correct 3 ms 8660 KB Output is correct
56 Correct 28 ms 23756 KB Output is correct
57 Correct 20 ms 23792 KB Output is correct
58 Correct 27 ms 23696 KB Output is correct
59 Correct 24 ms 23728 KB Output is correct
60 Correct 25 ms 23712 KB Output is correct
61 Correct 18 ms 23800 KB Output is correct
62 Correct 18 ms 23764 KB Output is correct
63 Correct 26 ms 23764 KB Output is correct
64 Correct 22 ms 23804 KB Output is correct
65 Correct 90 ms 38920 KB Output is correct
66 Correct 91 ms 38928 KB Output is correct
67 Correct 142 ms 38868 KB Output is correct
68 Correct 112 ms 38920 KB Output is correct
69 Correct 173 ms 38924 KB Output is correct
70 Correct 149 ms 38928 KB Output is correct
71 Correct 142 ms 38896 KB Output is correct
72 Correct 172 ms 38928 KB Output is correct
73 Correct 1454 ms 76776 KB Output is correct
74 Correct 1456 ms 76776 KB Output is correct
75 Correct 3151 ms 76784 KB Output is correct
76 Correct 1703 ms 76772 KB Output is correct
77 Correct 3328 ms 76780 KB Output is correct
78 Correct 2854 ms 76776 KB Output is correct
79 Correct 2254 ms 76796 KB Output is correct
80 Correct 2989 ms 76780 KB Output is correct
81 Execution timed out 5052 ms 228172 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2516 KB Output isn't correct
2 Halted 0 ms 0 KB -