제출 #639779

#제출 시각아이디문제언어결과실행 시간메모리
639779a_aguiloGlobal Warming (CEOI18_glo)C++14
28 / 100
2084 ms4548 KiB
#include<bits/stdc++.h> using namespace std; int n, x; int main(){ cin >> n >> x; int V[n]; int dp[n][2]; for(int i = 0; i < n; ++i) cin >> V[i]; for(int i = 0; i < n; ++i){ dp[i][0] = dp[i][1] = 1; } int ans = 1; for(int i = 1; i < n; ++i){ for(int j = 0; j < i; ++j){ if(V[j] < V[i]){ dp[i][0] = max(dp[i][0], dp[j][0]+1); dp[i][1] = max(dp[i][1], dp[j][1]+1); ans = max(ans, dp[i][0]); ans = max(ans, dp[i][1]); } if(V[j]-x < V[i]){ dp[i][1] = max(dp[i][1], dp[j][0]+1); ans = max(ans, dp[i][1]); } } } cout << ans << endl; 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...