Submission #1060111

# Submission time Handle Problem Language Result Execution time Memory
1060111 2024-08-15T10:41:49 Z ali2241 Global Warming (CEOI18_glo) C++17
10 / 100
2000 ms 4264 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

void fun() {
    int n, x;
    cin >> n >> x;
    int arr[n];
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    int mx = 0;
    for (int i = -x; i <= x; ++i) {
        vector<int> lis;
        for (int j = 0; j < n; ++j) {
            int a = arr[j], b = arr[j] + i;
            if (a < b) {
                swap(a, b);
            }
            int p1 = lower_bound(lis.begin(), lis.end(), a) - lis.begin();
            if (p1 == lis.size() or lis.empty()) {
                lis.push_back(a);
            }
            else {
                lis[p1] = a;
            }
            int p2 = lower_bound(lis.begin(), lis.end(), b) - lis.begin();
            if (p2 == lis.size()) {
                lis.push_back(b);
            }
            else {
                lis[p2] = b;
            }
        }
        mx = max(mx, (int)lis.size());
    }
    cout << mx << "\n";
}
 
int32_t main() {
    fun();
}

Compilation message

glo.cpp: In function 'void fun()':
glo.cpp:22:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             if (p1 == lis.size() or lis.empty()) {
      |                 ~~~^~~~~~~~~~~~~
glo.cpp:29:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if (p2 == lis.size()) {
      |                 ~~~^~~~~~~~~~~~~
# 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 Incorrect 0 ms 348 KB Output isn't correct
11 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 Incorrect 0 ms 348 KB Output isn't correct
11 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 Incorrect 0 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3668 KB Output is correct
2 Correct 71 ms 3768 KB Output is correct
3 Correct 61 ms 3872 KB Output is correct
4 Correct 62 ms 3664 KB Output is correct
5 Correct 43 ms 4264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 1284 KB Output is correct
2 Correct 43 ms 1304 KB Output is correct
3 Correct 43 ms 1116 KB Output is correct
4 Incorrect 23 ms 1552 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2061 ms 2132 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 Incorrect 0 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -