# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
540525 | 2022-03-20T16:33:55 Z | juankipedia | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 476 KB |
# include <bits/stdc++.h> using namespace std; /*************************************************************************************/ # define endl "\n" # define io_boost std::ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); typedef unsigned long long int ulli; typedef long long int lli; /*************************************JUANKIPEDIA*************************************/ const int MAXN = 200005; lli a[MAXN], J; int len, n; int lis[MAXN]; vector<lli> s; int LIS(){ len = 0; vector<int> l; int lis_len[MAXN], pos; for(int i = 0; i < n; i++){ int j = upper_bound(l.begin(), l.end(), s[i]) - l.begin(); if(j == l.size()) l.push_back(s[i]); else l[j] = s[i]; lis_len[i] = j + 1; if(lis_len[i] > len){ len = lis_len[i]; pos = i; } } return len; } int main(){ io_boost; cin >> n >> J; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < n; i++) if((i + 1) * J >= a[i]) s.push_back((i + 1) * J - a[i]); cout << n - LIS() << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 476 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 476 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 476 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 476 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |