Submission #797260

# Submission time Handle Problem Language Result Execution time Memory
797260 2023-07-29T08:36:26 Z dimasnbayu Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define start cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define endl '\n'
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fflush(stdout); cout.flush();

/*********************************/
/*********************************/

int a[200005], b[200005];
int main(){
	start
    int n, m; cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=(m*i)-a[i];
    }   
    
    vector<int>v;
    for(int i=1;i<=n;i++){
        int x=b[i];
        if(x<0) continue;
        int l=0, r=v.size()-1;
        int idx=-1;
        while(l<=r){
            int mid=(l+r)/2;
            if(x<=v[mid]){
                r=mid-1;
                idx=mid;
            }
            else l=mid+1;
        }
        if(idx!=-1) v[idx]=x;
        else v.push_back(x);
    }
    int komp=v.size();
    cout<<n-komp<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -