## 답안 #712508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712508 2023-03-19T00:06:43 Z vjudge1 Tortoise (CEOI21_tortoise) C++11
48 / 100
3000 ms 430904 KB
```#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _all(i, a, b) for (int i = (a); i <= (int)(b); ++i)
int D[603][302][302][2];  /// 当前时间、当前位置、山数、手数 ->
///  最后一座山的位置
const int INF = 0x3f3f3f3f;
int solve(int n) {
int ans = 0;
vector<int> A(n + 1), S(n + 1);
_all(i, 1, n) cin >> A[i], S[i] = S[i - 1] + max(A[i], 0);
memset(D, 0x3f, sizeof(D));
D[0][1][0][0] = 0;
_all(t, 0, 2 * n + 1) _all(i, 1, n) _all(j, 0, n) {
int *d = D[t][i][j];
_all(c, 0, 1) if (d[c] < INF) ans = max(ans, j);  // 更新答案
/// 不打发时间的活动
if (A[i] == -1) d[0] = min(d[0], d[1]);         /// 放在山里
if (A[i] > 0 && d[0] < S[i] && i + i - 2 >= t)  // 假的?
D[t][i][j + 1][1] = min(D[t][i][j + 1][1], max(d[0], S[i - 1]) + 1);
_all(c, 0, 1) {  /// 移动
D[t + 1][i - 1][j][c] = min(D[t + 1][i - 1][j][c], d[c]);
D[t + 1][i + 1][j][c] = min(D[t + 1][i + 1][j][c], d[c]);
}
}
return S[n] - ans;
}
int main() {
for (int n; cin >> n;)
printf("%d\n", solve(n));
}```

#### Subtask #1 8.0 / 8.0

# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 430760 KB Output is correct
2 Correct 163 ms 430700 KB Output is correct
3 Correct 168 ms 430780 KB Output is correct
4 Correct 156 ms 430824 KB Output is correct
5 Correct 153 ms 430708 KB Output is correct
6 Correct 182 ms 430756 KB Output is correct
7 Correct 160 ms 430708 KB Output is correct
8 Correct 153 ms 430688 KB Output is correct
9 Correct 167 ms 430776 KB Output is correct
10 Correct 156 ms 430660 KB Output is correct
11 Correct 161 ms 430856 KB Output is correct
12 Correct 189 ms 430836 KB Output is correct
13 Correct 153 ms 430676 KB Output is correct
14 Correct 151 ms 430696 KB Output is correct
15 Correct 153 ms 430688 KB Output is correct
16 Correct 171 ms 430708 KB Output is correct
17 Correct 165 ms 430696 KB Output is correct
18 Correct 150 ms 430720 KB Output is correct
19 Correct 153 ms 430780 KB Output is correct
20 Correct 170 ms 430796 KB Output is correct
21 Correct 169 ms 430696 KB Output is correct
22 Correct 158 ms 430668 KB Output is correct
23 Correct 158 ms 430708 KB Output is correct
24 Correct 181 ms 430688 KB Output is correct
25 Correct 159 ms 430704 KB Output is correct
26 Correct 159 ms 430708 KB Output is correct

#### Subtask #2 10.0 / 10.0

# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 430760 KB Output is correct
2 Correct 163 ms 430700 KB Output is correct
3 Correct 168 ms 430780 KB Output is correct
4 Correct 156 ms 430824 KB Output is correct
5 Correct 153 ms 430708 KB Output is correct
6 Correct 182 ms 430756 KB Output is correct
7 Correct 160 ms 430708 KB Output is correct
8 Correct 153 ms 430688 KB Output is correct
9 Correct 167 ms 430776 KB Output is correct
10 Correct 156 ms 430660 KB Output is correct
11 Correct 161 ms 430856 KB Output is correct
12 Correct 189 ms 430836 KB Output is correct
13 Correct 153 ms 430676 KB Output is correct
14 Correct 151 ms 430696 KB Output is correct
15 Correct 153 ms 430688 KB Output is correct
16 Correct 171 ms 430708 KB Output is correct
17 Correct 165 ms 430696 KB Output is correct
18 Correct 150 ms 430720 KB Output is correct
19 Correct 153 ms 430780 KB Output is correct
20 Correct 170 ms 430796 KB Output is correct
21 Correct 169 ms 430696 KB Output is correct
22 Correct 158 ms 430668 KB Output is correct
23 Correct 158 ms 430708 KB Output is correct
24 Correct 181 ms 430688 KB Output is correct
25 Correct 159 ms 430704 KB Output is correct
26 Correct 159 ms 430708 KB Output is correct
27 Correct 294 ms 430668 KB Output is correct
28 Correct 317 ms 430832 KB Output is correct
29 Correct 309 ms 430756 KB Output is correct
30 Correct 268 ms 430720 KB Output is correct
31 Correct 371 ms 430852 KB Output is correct
32 Correct 242 ms 430720 KB Output is correct
33 Correct 318 ms 430772 KB Output is correct
34 Correct 266 ms 430868 KB Output is correct
35 Correct 365 ms 430696 KB Output is correct
36 Correct 329 ms 430844 KB Output is correct
37 Correct 388 ms 430884 KB Output is correct
38 Correct 323 ms 430780 KB Output is correct
39 Correct 359 ms 430776 KB Output is correct
40 Correct 334 ms 430776 KB Output is correct
41 Correct 343 ms 430692 KB Output is correct

#### Subtask #3 30.0 / 30.0

# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 430760 KB Output is correct
2 Correct 163 ms 430700 KB Output is correct
3 Correct 168 ms 430780 KB Output is correct
4 Correct 156 ms 430824 KB Output is correct
5 Correct 153 ms 430708 KB Output is correct
6 Correct 182 ms 430756 KB Output is correct
7 Correct 160 ms 430708 KB Output is correct
8 Correct 153 ms 430688 KB Output is correct
9 Correct 167 ms 430776 KB Output is correct
10 Correct 156 ms 430660 KB Output is correct
11 Correct 161 ms 430856 KB Output is correct
12 Correct 189 ms 430836 KB Output is correct
13 Correct 153 ms 430676 KB Output is correct
14 Correct 151 ms 430696 KB Output is correct
15 Correct 153 ms 430688 KB Output is correct
16 Correct 171 ms 430708 KB Output is correct
17 Correct 165 ms 430696 KB Output is correct
18 Correct 150 ms 430720 KB Output is correct
19 Correct 153 ms 430780 KB Output is correct
20 Correct 170 ms 430796 KB Output is correct
21 Correct 169 ms 430696 KB Output is correct
22 Correct 158 ms 430668 KB Output is correct
23 Correct 158 ms 430708 KB Output is correct
24 Correct 181 ms 430688 KB Output is correct
25 Correct 159 ms 430704 KB Output is correct
26 Correct 159 ms 430708 KB Output is correct
27 Correct 294 ms 430668 KB Output is correct
28 Correct 317 ms 430832 KB Output is correct
29 Correct 309 ms 430756 KB Output is correct
30 Correct 268 ms 430720 KB Output is correct
31 Correct 371 ms 430852 KB Output is correct
32 Correct 242 ms 430720 KB Output is correct
33 Correct 318 ms 430772 KB Output is correct
34 Correct 266 ms 430868 KB Output is correct
35 Correct 365 ms 430696 KB Output is correct
36 Correct 329 ms 430844 KB Output is correct
37 Correct 388 ms 430884 KB Output is correct
38 Correct 323 ms 430780 KB Output is correct
39 Correct 359 ms 430776 KB Output is correct
40 Correct 334 ms 430776 KB Output is correct
41 Correct 343 ms 430692 KB Output is correct
42 Correct 231 ms 430728 KB Output is correct
43 Correct 232 ms 430776 KB Output is correct
44 Correct 257 ms 430708 KB Output is correct
45 Correct 293 ms 430868 KB Output is correct
46 Correct 254 ms 430772 KB Output is correct
47 Correct 225 ms 430740 KB Output is correct
48 Correct 273 ms 430776 KB Output is correct
49 Correct 256 ms 430844 KB Output is correct
50 Correct 283 ms 430708 KB Output is correct
51 Correct 307 ms 430904 KB Output is correct
52 Correct 238 ms 430772 KB Output is correct
53 Correct 303 ms 430780 KB Output is correct
54 Correct 313 ms 430704 KB Output is correct
55 Correct 271 ms 430672 KB Output is correct
56 Correct 349 ms 430776 KB Output is correct
57 Correct 214 ms 430852 KB Output is correct
58 Correct 297 ms 430668 KB Output is correct
59 Correct 242 ms 430844 KB Output is correct
60 Correct 269 ms 430768 KB Output is correct
61 Correct 289 ms 430660 KB Output is correct
62 Correct 287 ms 430736 KB Output is correct

#### Subtask #4 0 / 25.0

# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 430760 KB Output is correct
2 Correct 163 ms 430700 KB Output is correct
3 Correct 168 ms 430780 KB Output is correct
4 Correct 156 ms 430824 KB Output is correct
5 Correct 153 ms 430708 KB Output is correct
6 Correct 182 ms 430756 KB Output is correct
7 Correct 160 ms 430708 KB Output is correct
8 Correct 153 ms 430688 KB Output is correct
9 Correct 167 ms 430776 KB Output is correct
10 Correct 156 ms 430660 KB Output is correct
11 Correct 161 ms 430856 KB Output is correct
12 Correct 189 ms 430836 KB Output is correct
13 Correct 153 ms 430676 KB Output is correct
14 Correct 151 ms 430696 KB Output is correct
15 Correct 153 ms 430688 KB Output is correct
16 Correct 171 ms 430708 KB Output is correct
17 Correct 165 ms 430696 KB Output is correct
18 Correct 150 ms 430720 KB Output is correct
19 Correct 153 ms 430780 KB Output is correct
20 Correct 170 ms 430796 KB Output is correct
21 Correct 169 ms 430696 KB Output is correct
22 Correct 158 ms 430668 KB Output is correct
23 Correct 158 ms 430708 KB Output is correct
24 Correct 181 ms 430688 KB Output is correct
25 Correct 159 ms 430704 KB Output is correct
26 Correct 159 ms 430708 KB Output is correct
27 Correct 294 ms 430668 KB Output is correct
28 Correct 317 ms 430832 KB Output is correct
29 Correct 309 ms 430756 KB Output is correct
30 Correct 268 ms 430720 KB Output is correct
31 Correct 371 ms 430852 KB Output is correct
32 Correct 242 ms 430720 KB Output is correct
33 Correct 318 ms 430772 KB Output is correct
34 Correct 266 ms 430868 KB Output is correct
35 Correct 365 ms 430696 KB Output is correct
36 Correct 329 ms 430844 KB Output is correct
37 Correct 388 ms 430884 KB Output is correct
38 Correct 323 ms 430780 KB Output is correct
39 Correct 359 ms 430776 KB Output is correct
40 Correct 334 ms 430776 KB Output is correct
41 Correct 343 ms 430692 KB Output is correct
42 Correct 231 ms 430728 KB Output is correct
43 Correct 232 ms 430776 KB Output is correct
44 Correct 257 ms 430708 KB Output is correct
45 Correct 293 ms 430868 KB Output is correct
46 Correct 254 ms 430772 KB Output is correct
47 Correct 225 ms 430740 KB Output is correct
48 Correct 273 ms 430776 KB Output is correct
49 Correct 256 ms 430844 KB Output is correct
50 Correct 283 ms 430708 KB Output is correct
51 Correct 307 ms 430904 KB Output is correct
52 Correct 238 ms 430772 KB Output is correct
53 Correct 303 ms 430780 KB Output is correct
54 Correct 313 ms 430704 KB Output is correct
55 Correct 271 ms 430672 KB Output is correct
56 Correct 349 ms 430776 KB Output is correct
57 Correct 214 ms 430852 KB Output is correct
58 Correct 297 ms 430668 KB Output is correct
59 Correct 242 ms 430844 KB Output is correct
60 Correct 269 ms 430768 KB Output is correct
61 Correct 289 ms 430660 KB Output is correct
62 Correct 287 ms 430736 KB Output is correct
63 Execution timed out 3074 ms 430812 KB Time limit exceeded
64 Halted 0 ms 0 KB -

#### Subtask #5 0 / 27.0

# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 430760 KB Output is correct
2 Correct 163 ms 430700 KB Output is correct
3 Correct 168 ms 430780 KB Output is correct
4 Correct 156 ms 430824 KB Output is correct
5 Correct 153 ms 430708 KB Output is correct
6 Correct 182 ms 430756 KB Output is correct
7 Correct 160 ms 430708 KB Output is correct
8 Correct 153 ms 430688 KB Output is correct
9 Correct 167 ms 430776 KB Output is correct
10 Correct 156 ms 430660 KB Output is correct
11 Correct 161 ms 430856 KB Output is correct
12 Correct 189 ms 430836 KB Output is correct
13 Correct 153 ms 430676 KB Output is correct
14 Correct 151 ms 430696 KB Output is correct
15 Correct 153 ms 430688 KB Output is correct
16 Correct 171 ms 430708 KB Output is correct
17 Correct 165 ms 430696 KB Output is correct
18 Correct 150 ms 430720 KB Output is correct
19 Correct 153 ms 430780 KB Output is correct
20 Correct 170 ms 430796 KB Output is correct
21 Correct 169 ms 430696 KB Output is correct
22 Correct 158 ms 430668 KB Output is correct
23 Correct 158 ms 430708 KB Output is correct
24 Correct 181 ms 430688 KB Output is correct
25 Correct 159 ms 430704 KB Output is correct
26 Correct 159 ms 430708 KB Output is correct
27 Correct 294 ms 430668 KB Output is correct
28 Correct 317 ms 430832 KB Output is correct
29 Correct 309 ms 430756 KB Output is correct
30 Correct 268 ms 430720 KB Output is correct
31 Correct 371 ms 430852 KB Output is correct
32 Correct 242 ms 430720 KB Output is correct
33 Correct 318 ms 430772 KB Output is correct
34 Correct 266 ms 430868 KB Output is correct
35 Correct 365 ms 430696 KB Output is correct
36 Correct 329 ms 430844 KB Output is correct
37 Correct 388 ms 430884 KB Output is correct
38 Correct 323 ms 430780 KB Output is correct
39 Correct 359 ms 430776 KB Output is correct
40 Correct 334 ms 430776 KB Output is correct
41 Correct 343 ms 430692 KB Output is correct
42 Correct 231 ms 430728 KB Output is correct
43 Correct 232 ms 430776 KB Output is correct
44 Correct 257 ms 430708 KB Output is correct
45 Correct 293 ms 430868 KB Output is correct
46 Correct 254 ms 430772 KB Output is correct
47 Correct 225 ms 430740 KB Output is correct
48 Correct 273 ms 430776 KB Output is correct
49 Correct 256 ms 430844 KB Output is correct
50 Correct 283 ms 430708 KB Output is correct
51 Correct 307 ms 430904 KB Output is correct
52 Correct 238 ms 430772 KB Output is correct
53 Correct 303 ms 430780 KB Output is correct
54 Correct 313 ms 430704 KB Output is correct
55 Correct 271 ms 430672 KB Output is correct
56 Correct 349 ms 430776 KB Output is correct
57 Correct 214 ms 430852 KB Output is correct
58 Correct 297 ms 430668 KB Output is correct
59 Correct 242 ms 430844 KB Output is correct
60 Correct 269 ms 430768 KB Output is correct
61 Correct 289 ms 430660 KB Output is correct
62 Correct 287 ms 430736 KB Output is correct
63 Execution timed out 3074 ms 430812 KB Time limit exceeded
64 Halted 0 ms 0 KB -