답안 #413453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
413453 2021-05-28T18:03:58 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 = 0; 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(dp), end(dp), b[i])-begin(dp));
    	if (pos >= int(size(dp))) {
    		dp.push_back(pos);
    	} else dp[pos] = b[i];
    }

    cout << n - int(size(dp)) << endl;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -