답안 #422039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422039 2021-06-09T15:39:11 Z rqi Rabbit Carrot (LMIO19_triusis) C++14
100 / 100
115 ms 5848 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;

#define pb push_back
#define bk back()
#define sz(x) (int)(x).size()

const int mx = 200005;
int N, M;
ll a[mx];
int main(){
	cin >> N >> M;
	for(int i = 1; i <= N; i++){
		cin >> a[i];
	}
	for(int i = 1; i <= N; i++){
		a[i]-=ll(i)*ll(M);
	}
	vl dp = vl{0};
	for(int i = 1; i <= N; i++){
		if(a[i] > 0) continue;
		if(a[i] <= dp.bk){
			dp.pb(a[i]);
			continue;
		}
		int lo = 0;
		int hi = sz(dp)-1;
		while(lo < hi){
			int mid = (lo+hi)/2+1;
			if(dp[mid] >= a[i]){
				lo = mid;
			}
			else{
				hi = mid-1;
			}
		}

		dp[lo+1] = a[i];
	}

	int ans = N-(sz(dp)-1);
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 2 ms 432 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 3 ms 436 KB Output is correct
24 Correct 2 ms 452 KB Output is correct
25 Correct 3 ms 460 KB Output is correct
26 Correct 3 ms 460 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 2 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 2 ms 332 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 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 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 432 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 436 KB Output is correct
8 Correct 2 ms 452 KB Output is correct
9 Correct 3 ms 460 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 460 KB Output is correct
13 Correct 2 ms 460 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 1 ms 296 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 3 ms 332 KB Output is correct
35 Correct 3 ms 332 KB Output is correct
36 Correct 3 ms 316 KB Output is correct
37 Correct 2 ms 460 KB Output is correct
38 Correct 3 ms 332 KB Output is correct
39 Correct 3 ms 440 KB Output is correct
40 Correct 2 ms 332 KB Output is correct
41 Correct 2 ms 332 KB Output is correct
42 Correct 3 ms 332 KB Output is correct
43 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 3 ms 316 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 3 ms 440 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 3 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 2 ms 432 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 3 ms 436 KB Output is correct
18 Correct 2 ms 452 KB Output is correct
19 Correct 3 ms 460 KB Output is correct
20 Correct 3 ms 460 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 2 ms 460 KB Output is correct
24 Correct 2 ms 332 KB Output is correct
25 Correct 2 ms 332 KB Output is correct
26 Correct 3 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 300 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 1 ms 296 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 296 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 52 ms 4312 KB Output is correct
45 Correct 97 ms 3740 KB Output is correct
46 Correct 93 ms 3780 KB Output is correct
47 Correct 91 ms 3752 KB Output is correct
48 Correct 60 ms 4944 KB Output is correct
49 Correct 72 ms 5124 KB Output is correct
50 Correct 115 ms 4880 KB Output is correct
51 Correct 88 ms 5848 KB Output is correct
52 Correct 63 ms 3880 KB Output is correct
53 Correct 66 ms 2996 KB Output is correct
54 Correct 69 ms 5052 KB Output is correct
55 Correct 78 ms 5008 KB Output is correct