# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1002895 | 2024-06-19T21:09:30 Z | ThegeekKnight16 | Cigle (COI21_cigle) | C++17 | 389 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; vector<int> d(N+1); for (int i = 1; i <= N; i++) cin >> d[i]; vector<vector<vector<int>>> C(N+1, vector<vector<int>>(N+1, vector<int>(N+1))); for (int i = 1; i <= N; i++) for (int j = i+1; j <= N; j++) { vector<int> somas; int sum = 0; for (int k = j-1; k >= i; k--) sum += d[k], somas.push_back(sum); somas.pop_back(); sum = 0; int resp = 0, p = 0; for (int k = j; k <= N; k++) { C[i][j][k] = resp; sum += d[k]; while (p < somas.size() && somas[p] < sum) ++p; if (p < somas.size() && somas[p] == sum) resp++, ++p; } } vector<vector<int>> dp(N+1, vector<int>(N+1)); for (int i = 2; i <= N; i++) for (int j = i; j <= N; j++) { dp[i][j] = 0; for (int k = 1; k < i; k++) dp[i][j] = max(dp[i][j], dp[k][i-1] + C[k][i][j]); // cerr << "dp[" << i << " " << j << "]: " << dp[i][j] << '\n'; } int resp = 0; for (int i = 1; i <= N; i++) resp = max(resp, dp[i][N]); cout << resp << '\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 2652 KB | Output is correct |
11 | Correct | 2 ms | 2652 KB | Output is correct |
12 | Correct | 2 ms | 2652 KB | Output is correct |
13 | Correct | 2 ms | 2652 KB | Output is correct |
14 | Correct | 2 ms | 2652 KB | Output is correct |
15 | Correct | 2 ms | 2652 KB | Output is correct |
16 | Correct | 2 ms | 2652 KB | Output is correct |
17 | Correct | 2 ms | 2652 KB | Output is correct |
18 | Correct | 2 ms | 2652 KB | Output is correct |
19 | Correct | 4 ms | 2648 KB | Output is correct |
20 | Correct | 3 ms | 2652 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 346 ms | 502356 KB | Output is correct |
2 | Correct | 352 ms | 502360 KB | Output is correct |
3 | Correct | 326 ms | 502352 KB | Output is correct |
4 | Correct | 346 ms | 502356 KB | Output is correct |
5 | Correct | 347 ms | 502284 KB | Output is correct |
6 | Correct | 381 ms | 502476 KB | Output is correct |
7 | Correct | 361 ms | 502356 KB | Output is correct |
8 | Correct | 384 ms | 502292 KB | Output is correct |
9 | Correct | 368 ms | 502476 KB | Output is correct |
10 | Correct | 333 ms | 502356 KB | Output is correct |
11 | Correct | 345 ms | 502352 KB | Output is correct |
12 | Correct | 351 ms | 502460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 2652 KB | Output is correct |
11 | Correct | 2 ms | 2652 KB | Output is correct |
12 | Correct | 2 ms | 2652 KB | Output is correct |
13 | Correct | 2 ms | 2652 KB | Output is correct |
14 | Correct | 2 ms | 2652 KB | Output is correct |
15 | Correct | 2 ms | 2652 KB | Output is correct |
16 | Correct | 2 ms | 2652 KB | Output is correct |
17 | Correct | 2 ms | 2652 KB | Output is correct |
18 | Correct | 2 ms | 2652 KB | Output is correct |
19 | Correct | 4 ms | 2648 KB | Output is correct |
20 | Correct | 3 ms | 2652 KB | Output is correct |
21 | Correct | 346 ms | 502356 KB | Output is correct |
22 | Correct | 352 ms | 502360 KB | Output is correct |
23 | Correct | 326 ms | 502352 KB | Output is correct |
24 | Correct | 346 ms | 502356 KB | Output is correct |
25 | Correct | 347 ms | 502284 KB | Output is correct |
26 | Correct | 381 ms | 502476 KB | Output is correct |
27 | Correct | 361 ms | 502356 KB | Output is correct |
28 | Correct | 384 ms | 502292 KB | Output is correct |
29 | Correct | 368 ms | 502476 KB | Output is correct |
30 | Correct | 333 ms | 502356 KB | Output is correct |
31 | Correct | 345 ms | 502352 KB | Output is correct |
32 | Correct | 351 ms | 502460 KB | Output is correct |
33 | Correct | 328 ms | 502468 KB | Output is correct |
34 | Correct | 352 ms | 502356 KB | Output is correct |
35 | Correct | 326 ms | 502340 KB | Output is correct |
36 | Correct | 341 ms | 502324 KB | Output is correct |
37 | Correct | 376 ms | 502228 KB | Output is correct |
38 | Correct | 368 ms | 502608 KB | Output is correct |
39 | Correct | 374 ms | 502472 KB | Output is correct |
40 | Correct | 389 ms | 502356 KB | Output is correct |
41 | Correct | 374 ms | 502356 KB | Output is correct |
42 | Correct | 360 ms | 502356 KB | Output is correct |
43 | Correct | 331 ms | 502356 KB | Output is correct |
44 | Correct | 379 ms | 502356 KB | Output is correct |
45 | Correct | 372 ms | 502352 KB | Output is correct |
46 | Correct | 335 ms | 502356 KB | Output is correct |
47 | Correct | 344 ms | 502356 KB | Output is correct |
48 | Correct | 331 ms | 502612 KB | Output is correct |
49 | Correct | 346 ms | 502360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 604 KB | Output is correct |
10 | Correct | 2 ms | 2652 KB | Output is correct |
11 | Correct | 2 ms | 2652 KB | Output is correct |
12 | Correct | 2 ms | 2652 KB | Output is correct |
13 | Correct | 2 ms | 2652 KB | Output is correct |
14 | Correct | 2 ms | 2652 KB | Output is correct |
15 | Correct | 2 ms | 2652 KB | Output is correct |
16 | Correct | 2 ms | 2652 KB | Output is correct |
17 | Correct | 2 ms | 2652 KB | Output is correct |
18 | Correct | 2 ms | 2652 KB | Output is correct |
19 | Correct | 4 ms | 2648 KB | Output is correct |
20 | Correct | 3 ms | 2652 KB | Output is correct |
21 | Correct | 346 ms | 502356 KB | Output is correct |
22 | Correct | 352 ms | 502360 KB | Output is correct |
23 | Correct | 326 ms | 502352 KB | Output is correct |
24 | Correct | 346 ms | 502356 KB | Output is correct |
25 | Correct | 347 ms | 502284 KB | Output is correct |
26 | Correct | 381 ms | 502476 KB | Output is correct |
27 | Correct | 361 ms | 502356 KB | Output is correct |
28 | Correct | 384 ms | 502292 KB | Output is correct |
29 | Correct | 368 ms | 502476 KB | Output is correct |
30 | Correct | 333 ms | 502356 KB | Output is correct |
31 | Correct | 345 ms | 502352 KB | Output is correct |
32 | Correct | 351 ms | 502460 KB | Output is correct |
33 | Correct | 328 ms | 502468 KB | Output is correct |
34 | Correct | 352 ms | 502356 KB | Output is correct |
35 | Correct | 326 ms | 502340 KB | Output is correct |
36 | Correct | 341 ms | 502324 KB | Output is correct |
37 | Correct | 376 ms | 502228 KB | Output is correct |
38 | Correct | 368 ms | 502608 KB | Output is correct |
39 | Correct | 374 ms | 502472 KB | Output is correct |
40 | Correct | 389 ms | 502356 KB | Output is correct |
41 | Correct | 374 ms | 502356 KB | Output is correct |
42 | Correct | 360 ms | 502356 KB | Output is correct |
43 | Correct | 331 ms | 502356 KB | Output is correct |
44 | Correct | 379 ms | 502356 KB | Output is correct |
45 | Correct | 372 ms | 502352 KB | Output is correct |
46 | Correct | 335 ms | 502356 KB | Output is correct |
47 | Correct | 344 ms | 502356 KB | Output is correct |
48 | Correct | 331 ms | 502612 KB | Output is correct |
49 | Correct | 346 ms | 502360 KB | Output is correct |
50 | Runtime error | 237 ms | 524288 KB | Execution killed with signal 9 |
51 | Halted | 0 ms | 0 KB | - |