Submission #731672

# Submission time Handle Problem Language Result Execution time Memory
731672 2023-04-27T18:18:53 Z Toxtaq Global Warming (CEOI18_glo) C++17
25 / 100
2000 ms 3100 KB
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, x, res = 0;
    cin >> n >> x;
    vector<int>t(n);
    for(int i = 0;i < n;++i)cin >> t[i];
    if(x == 0){
        vector<int>tempo;
        for(int k = 0;k < n;++k){
            int pos = lower_bound(tempo.begin(), tempo.end(), t[k]) - tempo.begin();
            if(pos == tempo.size())tempo.push_back(t[k]);
            else tempo[pos] = t[k];
        }
        cout << tempo.size();
        return 0;
    }
    for(int i = -x;i <= x;++i){
        for(int l = 0;l < n;++l){
            vector<int>modif;
            modif = t;
            for(int r = l;r < n;++r){
                modif[r] += i;
                vector<int>tempo;
                for(int k = 0;k < n;++k){
                    int pos = lower_bound(tempo.begin(), tempo.end(), modif[k]) - tempo.begin();
                    if(pos == tempo.size())tempo.push_back(modif[k]);
                    else tempo[pos] = modif[k];
                }
                res = max(res, (int)tempo.size());
            }
        }
    }
    cout << res;
}

Compilation message

glo.cpp: In function 'int main()':
glo.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |             if(pos == tempo.size())tempo.push_back(t[k]);
      |                ~~~~^~~~~~~~~~~~~~~
glo.cpp:28:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |                     if(pos == tempo.size())tempo.push_back(modif[k]);
      |                        ~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 22 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 69 ms 332 KB Output is correct
15 Correct 30 ms 212 KB Output is correct
16 Correct 28 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 22 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 69 ms 332 KB Output is correct
15 Correct 30 ms 212 KB Output is correct
16 Correct 28 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Execution timed out 2060 ms 212 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 980 KB Output is correct
2 Correct 83 ms 2980 KB Output is correct
3 Correct 82 ms 2996 KB Output is correct
4 Correct 84 ms 3100 KB Output is correct
5 Correct 58 ms 2856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 980 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 22 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 69 ms 332 KB Output is correct
15 Correct 30 ms 212 KB Output is correct
16 Correct 28 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 2 ms 212 KB Output is correct
19 Execution timed out 2060 ms 212 KB Time limit exceeded
20 Halted 0 ms 0 KB -