# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103952 | vjudge1 | Global Warming (CEOI18_glo) | C++17 | 2064 ms | 3132 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<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> dp;
int lis(int t[],int n,int a,int b,int x){
dp.clear();
int cur;
for(int i=1;i<=n;++i){
cur=t[i]+x*(i<=b);
int idx=lower_bound(dp.begin(),dp.end(),cur)-dp.begin();
if(idx==dp.size()) dp.push_back(cur);
else dp[idx]=cur;
}
return dp.size();
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int n,x; cin >> n >> x;
int t[n+1];
for(int i=1;i<=n;++i) cin >> t[i];
int maxi=0;
if(x==0){
cout << lis(t,n,0,0,0);
return 0;
}
for(int e=1;e<=n;++e){
maxi=max(lis(t,n,1,e,-x),maxi);
}
cout << maxi;
}
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... |