제출 #432908

#제출 시각아이디문제언어결과실행 시간메모리
432908lukadupliGlobal Warming (CEOI18_glo)C++14
0 / 100
2070 ms3372 KiB
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 5; int n, x, arr[MAX]; int memo[MAX][2]; int rek(int pos, bool drop){ if(pos == 0) return 1; if(memo[pos][drop] > 0) return memo[pos][drop]; int maxi = 0; for(int i = 0; i < pos; i++){ if(arr[pos] > arr[i]) maxi = max(maxi, rek(i, drop)); if(arr[i] - arr[pos] < x && drop) maxi = max(maxi, rek(i, 0)); } return memo[pos][drop] = maxi + 1; } int main() { cin >> n >> x; for(int i = 0; i < n; i++) cin >> arr[i]; cout << rek(n - 1, 1) << '\n'; /*for(int i = 0; i < n; i++){ printf("%d\n drop left: %d\n no drop left: %d\n", i, rek(i, 1), rek(i, 0)); }*/ 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...