제출 #136257

#제출 시각아이디문제언어결과실행 시간메모리
136257SOIVIEONEGlobal Warming (CEOI18_glo)C++14
45 / 100
195 ms6532 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 222222; ll a[N], l[N], d[N]; pair<int, int> change[N]; int main() { ll n, x; cin >> n >> x; for(int i = 1; i <= n; i ++) cin >> a[i]; int lis = 0; for(int i = 0; i <= n; i ++) l[i] = 1e9; int ans = 0; for(int i = 1; i <= n; i ++) { int id = lower_bound(l + 1, l + n + 1, a[i]) - l; change[i] = {id, l[id]}; l[id] = a[i]; ans = max(ans, id); } int lds = 0; for(int i = n; i >= 1; i --) { int id = lower_bound(d + 1, d + n + 1, a[i] + x, greater<int>()) - d; l[change[i].first] = change[i].second; d[id] = a[i] + x; // cout << i << ' ' << id << '\n'; // for(int j = 0; j <= lds - 1; j ++) // cout << d[j] << ' '; // cout << '\n'; int it = lower_bound(l + 1, l + n + 1, a[i] + x) - l-1; ans = max(ans, it + id); } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

glo.cpp: In function 'int main()':
glo.cpp:16:6: warning: unused variable 'lis' [-Wunused-variable]
  int lis = 0;
      ^~~
glo.cpp:27:6: warning: unused variable 'lds' [-Wunused-variable]
  int lds = 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...