Submission #413451

# Submission time Handle Problem Language Result Execution time Memory
413451 2021-05-28T18:01:31 Z nkato Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;


int main() {


	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m; cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
    	cin >> a[i];
    }

    vector<int> b;
    for(int i = 1; i < n; i++) {
    	if ((i+1)*m >= a[i]) b.push_back((i+1)*m - a[i]);
    }

    vector<int> dp;
    for(int i = 0; i < (int)size(b); i++) {
    	int pos = int(upper_bound(begin(b), end(b), b[i])-begin(b));
    	if (pos >= int(size(dp))) {
    		dp.push_back(pos);
    	} else dp[pos] = b[i];
    }

    cout << n - int(size(dp)) << endl;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -