제출 #1149820

#제출 시각아이디문제언어결과실행 시간메모리
1149820zhasynGlobal Warming (CEOI18_glo)C++20
28 / 100
2096 ms3400 KiB
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 2 * 1e5 + 100, M = 4096 + 10, len = 21, inf = 1e18;
const ll mod = 1e9 + 7;
ll um(ll a, ll b){
	return (1LL * a * b % mod + mod) % mod;
}
ll n, dp[N], a[N];
ll got(){
	for(ll i = 1; i <= n; i++){
		dp[i] = LLONG_MAX;
	}
	dp[0] = LLONG_MIN;
	ll mx = 1;
	for(ll i = 1; i <= n; i++){
		ll k = lower_bound(dp, dp + n, a[i]) - dp;
		if(a[i] > dp[k - 1]){
			dp[k] = a[i];
			mx = max(mx, k);
		}
	}
	return mx;
}

int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(NULL);
  	ll x, ans = 1;
  	cin >> n >> x;
  	for(ll i = 1; i <= n; i++){
  		cin >> a[i];
  	}
  	
	for(ll i = 1; i <= n; i++){
		a[i] -= x;
		ans = max(ans, got());
	}
	cout << ans;
  return 0;
}

 
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...