제출 #1127677

#제출 시각아이디문제언어결과실행 시간메모리
1127677Haciyev12Global Warming (CEOI18_glo)C++20
38 / 100
2094 ms4548 KiB
#include "bits/stdc++.h" #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pb push_back #define in insert #define F first #define S second #define vll vector<ll> #define all(v) v.begin(),v.end() #define endl '\n' #define pii pair<ll,ll> #define yes cout << "YES" << endl; #define no cout << "NO" << endl; using namespace std; const ll INF = 1e18, mod = 1e9 + 7, N = 2e5 + 5; ll gcd(ll a, ll b){ if(b == 0){ return a; } return gcd(b, a%b); } ll lcm(ll a, ll b){ return (a / gcd(a,b)) * b; } vector<ll>e; ll n,x; ll lis(vector<ll>&a){ vector<ll>ans; ll f = -1; for(int i = 0; i < a.size(); i++){ //cout << a[i] << " "; auto it = lower_bound(all(ans), a[i]); if(it == ans.end()){ ans.pb(a[i]); } else{ f = i; *it = a[i]; } } //cout << endl; return ans.size() ; } void solve(){ cin >> n >> x; vector<ll>a(n); vector<ll>v; vector<ll>used(n, 0); for(int i = 0; i < n; i++){ cin >> a[i]; } if(x == 0){ cout << lis(a) << endl; return; } ll maxi = 0; for(int i = 0; i < n; i++){ a[i] -= x; maxi = max(maxi, lis(a)); } cout <<maxi << endl; } int main() { fast; ll t = 1; // cin >> t; while(t--){ solve(); } 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...