Submission #1109711

# Submission time Handle Problem Language Result Execution time Memory
1109711 2024-11-07T10:56:48 Z KindaGoodGames Global Warming (CEOI18_glo) C++14
15 / 100
2000 ms 1864 KB
#include<bits/stdc++.h>

#define ll long long
#define pii pair<int,int>
#define tiii tuple<int,int,int>

using namespace std;


int main(){
    int n, x;
    cin >> n >> x;

    vector<int> oarr(n);
    for(int i = 0; i < n; i++ ){
        cin >> oarr[i];
    }

    int ma = 0;
    for(int k = -x; k <= x; k++){
        for(int l = 0; l < n; l++){
            for(int r = l; r< n; r++){
                vector<int> arr = oarr;
                for(int i = l; i <= r; i++){
                    arr[i] += k;
                }

                vector<int> dp;
                for(int i = 0; i < n; i++){
                    auto it = lower_bound(dp.begin(),dp.end(),arr[i]) - dp.begin();

                    if(it >= dp.size()) {
                        dp.push_back(arr[i]);
                    }else{
                        dp[it] = arr[i];
                    }
                }
                ma = max(ma,(int)dp.size());
            }
        }
    }
    

    cout << ma << endl;
}

Compilation message

glo.cpp: In function 'int main()':
glo.cpp:32:27: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                     if(it >= dp.size()) {
      |                        ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 14 ms 336 KB Output is correct
13 Correct 1 ms 440 KB Output is correct
14 Correct 41 ms 336 KB Output is correct
15 Correct 28 ms 336 KB Output is correct
16 Correct 18 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 14 ms 336 KB Output is correct
13 Correct 1 ms 440 KB Output is correct
14 Correct 41 ms 336 KB Output is correct
15 Correct 28 ms 336 KB Output is correct
16 Correct 18 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Execution timed out 2059 ms 336 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2057 ms 1864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2051 ms 652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2040 ms 1096 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 14 ms 336 KB Output is correct
13 Correct 1 ms 440 KB Output is correct
14 Correct 41 ms 336 KB Output is correct
15 Correct 28 ms 336 KB Output is correct
16 Correct 18 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Execution timed out 2059 ms 336 KB Time limit exceeded
20 Halted 0 ms 0 KB -