제출 #1276587

#제출 시각아이디문제언어결과실행 시간메모리
1276587desmond1015Global Warming (CEOI18_glo)C++20
28 / 100
2094 ms1224 KiB
#include "bits/stdc++.h"
using namespace std;

#define ll long long

const int MOD = 1e9+7;
const int INF = 1e9;

/**
 * tle
 */
void solve() {
  int n, x;
  cin >> n >> x;
  vector<int> t(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  int ans = 1;
  for (int i = 0; i < n; i++) {
    t[i] -= x;
    vector<int> dp;
    for (int j = 0; j < n; j++) {
      auto it = lower_bound(dp.begin(), dp.end(), t[j]);
      if (it == dp.end()) {
        dp.push_back(t[j]);
      } else {
        *it = t[j];
      }
    }
    ans = max(ans, (int) dp.size());
  }
  cout << ans << '\n';
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

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

  // int 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...