# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655673 | 2022-11-05T08:29:14 Z | tunay_kerem | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 340 KB |
// author : tunay_ke #include <bits/stdc++.h> #define ii pair<int,int> #define PB push #define pb push_back #define st first #define nd second #define all(a) a.begin(),a.end() #define iii pair<ii,int> #define mid ((l+r)/2) #define endl "\n" using namespace std; int n,a,k; vector<int> v; int main() { cin>>n>>k; for (int i = 0; i < n; ++i) { cin>>a; v.pb(a); } vector<long long int> fx; for (int i = 1; i <= n; ++i) { if(1ll*i*k-v[i-1]<0)continue; fx.pb(1ll*i*k-v[i-1]); } vector<long long int> lis; for (int i = 0; i < n; ++i) { int sonra=upper_bound(lis.begin(),lis.end(),fx[i])-lis.begin(); //cout<<sonra<<endl; if(sonra==lis.size()){ lis.pb(fx[i]); } else lis[sonra]=fx[i]; } cout<<n-lis.size(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 340 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 | 340 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 | 340 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 | 340 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |