# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1109711 | KindaGoodGames | Global Warming (CEOI18_glo) | C++14 | 2059 ms | 1864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |