제출 #971913

#제출 시각아이디문제언어결과실행 시간메모리
971913jadai007Global Warming (CEOI18_glo)C++17
38 / 100
2045 ms3568 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n,x, arr[200200], p, dp[200200], ans; signed main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> x; for(int i = 0; i<n; ++i) cin >> arr[i]; if(x == 0){ for(int i = 0; i<n; ++i){ int idx = lower_bound(dp, dp+p, arr[i]) - dp; if(idx == p) ++p; dp[idx] = arr[i]; } cout << p; return 0; } for(int i = 0; i<n; ++i){ memset(dp, 0, sizeof(dp)); p = 0; for(int j = 0; j<n; ++j){ int a = arr[j]; if(j <= i) a-=x; int idx = lower_bound(dp, dp+p, a) - dp; if(idx == p) p++; dp[idx] = a; } ans = max(ans, p); } cout << ans; }
#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...