# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958649 | 2024-04-06T09:43:52 Z | Bodisha | Rabbit Carrot (LMIO19_triusis) | C++17 | 0 ms | 344 KB |
#include <bits/stdc++.h> #define MAX_N 200005 #define MAX_A 10000000007 using namespace std; int n, m; int poles[MAX_N]; int dp[MAX_N]; int lds() { dp[0] = MAX_A; for(int i = 1; i <= n + 1; i++) { dp[i] = -1; } for(int i = 0; i <= n; i++) { int l = 0, r = n + 1; int ans = 0; while(l <= r) { int mid = l + (r - l) / 2; if(dp[mid] <= poles[i] && poles[i] - dp[mid] < m) { ans = mid; r = mid - 1; } else { l = mid + 1; } } dp[ans] = poles[i]; } for(int i = 1; i <= n + 1; i++) { if(poles[i] == -1) { return i - 1; } } return n + 1; } int main() { cin >> n >> m; poles[0] = 0; for(int i = 1; i <= n; i++) { cin >> poles[i]; } cout << lds() - 1; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |