제출 #957024

#제출 시각아이디문제언어결과실행 시간메모리
957024Charizard2021Global Warming (CEOI18_glo)C++17
15 / 100
70 ms1748 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n, x; cin >> n >> x; int a[n]; for(int i = 0;i < n; i++) cin >> a[i]; if(x == 0){ vector<int> dp; for(int i = 0; i < n; i++){ int idx = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin(); if(idx == (int)dp.size()){ dp.push_back(a[i]); } else{ dp[idx] = a[i]; } } cout << dp.size() << "\n"; } else{ if(n <= 1000){ int ans = 0; for(int i = -1; i < n; i++){ int b[n]; for(int j = 0; j < n; j++){ if(j <= i){ b[j] = a[j] - x; } else{ b[j] = a[j]; } } vector<int> dp; for(int j = 0; j < n; j++){ int idx = lower_bound(dp.begin(), dp.end(), b[j]) - dp.begin(); if(idx == (int)dp.size()){ dp.push_back(b[j]); } else{ dp[idx] = a[j]; } } ans = max(ans, (int)dp.size()); } cout << ans << "\n"; } } }
#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...