제출 #868008

#제출 시각아이디문제언어결과실행 시간메모리
868008WLZGlobal Warming (CEOI18_glo)C++17
28 / 100
2070 ms12008 KiB
#include <bits/stdc++.h> using namespace std; constexpr int INF = 0x3f3f3f3f; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; vector<int> t(n + 1); t[0] = -INF; for (int i = 1; i <= n; i++) cin >> t[i]; vector dp(n + 1, vector<int>(2, 0)); for (int i = 1; i <= n; i++) { for (int j = 0; j < i; j++) { if (t[j] < t[i]) { dp[i][0] = max(dp[i][0], dp[j][0] + 1); dp[i][1] = max(dp[i][1], dp[j][1] + 1); } if (t[j] < t[i] + x) dp[i][1] = max(dp[i][1], dp[j][0] + 1); } } int ans = 0; for (int i = 1; i <= n; i++) ans = max({ans, dp[i][0], dp[i][1]}); 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...