Submission #1060422

# Submission time Handle Problem Language Result Execution time Memory
1060422 2024-08-15T14:06:07 Z ali2241 Global Warming (CEOI18_glo) C++17
5 / 100
2000 ms 7688 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

void fun() {
    int n, x;
    cin >> n >> x;
    int arr[n + 1];
    arr[0] = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
    }
    int mx = 1;
    for (int i = -x; i <= +x; ++i) {
        int dp[n + 1][3];
        dp[0][0] = 0;
        dp[0][1] = 0;
        dp[0][2] = 0;
        for (int j = 1; j <= n; ++j) {
            dp[j][0] = dp[j][1] = dp[j][2] = 1;
            for (int k = 0; k < j; ++k) {
                if (arr[j] > arr[k]) {
                    dp[j][0] = max(dp[j][0], dp[k][0] + 1);
                    dp[j][1] = max(dp[j][1], dp[k][1] + 1);
                    dp[j][2] = max(dp[j][2], dp[k][2] + 1);
                }
                if (arr[j] + i > arr[k]) {
                    dp[j][1] = max(dp[j][1], dp[k][0] + 1);
                }
                if (arr[j] > arr[k + 5]) {
                    dp[j][2] = max(dp[j][2], dp[k][1] + 1);
                }
            }

            mx = max(mx, max(max(dp[j][0], dp[j][1]), dp[j][2]));
        }
    }
    cout << mx << "\n";
}
 
int32_t main() {
    fun();
}
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 7688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2054 ms 2396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2028 ms 4176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -