Submission #1060189

# Submission time Handle Problem Language Result Execution time Memory
1060189 2024-08-15T11:23:34 Z ali2241 Global Warming (CEOI18_glo) C++17
0 / 100
49 ms 3516 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;
        vector<int> ar;
        for (int j = 0; j < n; ++j) {
            int a = ar[j], b = ar[j] + i;
            if (b > a) {
                swap(a, b);
            }
            ar.push_back(a);
            ar.push_back(b);
        }
        for (int j = 0; j < 2 * n; ++j) {
            int a = ar[j];
            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;
            }
        }
        mx = max(mx, (int)lis.size());
    }
    cout << mx << "\n";
}
 
int32_t main() {
    fun();
}

Compilation message

glo.cpp: In function 'void fun()':
glo.cpp:28: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]
   28 |             if (p1 == lis.size() or lis.empty()) {
      |                 ~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 49 ms 3516 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 1116 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 1872 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -