Submission #785396

#TimeUsernameProblemLanguageResultExecution timeMemory
785396devariaotaGlobal Warming (CEOI18_glo)C++17
38 / 100
2065 ms3044 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, x; cin >> n >> x; vector<int> a(n); for(int &p : a) cin >> p; vector<int> dp; int ans=1; if(x==0) { for(int p : a) { auto it=lower_bound(dp.begin(), dp.end(), p); if(it==dp.end()) dp.push_back(p); else *it=p; } ans=dp.size(); } else { for(int i=0; i<n; i++) { dp.clear(); vector<int> temp=a; for(int k=i; k<n; k++) temp[k]+=x; for(int p : temp) { auto it=lower_bound(dp.begin(), dp.end(), p); if(it==dp.end()) dp.push_back(p); else *it=p; } ans=max(ans, (int)dp.size()); } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...