제출 #259899

#제출 시각아이디문제언어결과실행 시간메모리
259899Kenzo_1114Global Warming (CEOI18_glo)C++17
25 / 100
77 ms6532 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 200010; const int INF = 2e9 + 9; int n, x; long long int t[MAXN], dp[MAXN], l[MAXN], ans[MAXN]; int main () { scanf("%d %d", &n, &x); dp[0] = INF; for(int i = 1; i <= n; i++) scanf("%lld", &t[i]), dp[i] = INF; t[0] = -INF; for(int i = 1; i <= n; i++) { int cur = i - 1; while(t[cur] - x >= t[i]) cur = l[cur]; l[i] = cur; } for(int i = 1; i <= n; i++) { int it = lower_bound(dp, dp + n, t[i]) - dp; dp[it] = t[i]; ans[i] = it + 1; } dp[0] = INF; for(int i = 1; i <= n; i++) t[i] = INF - t[i], dp[i] = INF; long long int ANS = 0; for(int i = n; i > 0; i--) { int it = lower_bound(dp, dp + n, t[i]) - dp; dp[it] = t[i]; ANS = max(ANS, it + 1 + ans[l[i]]); } printf("%lld\n", ANS); }

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

glo.cpp: In function 'int main()':
glo.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &x);
  ~~~~~^~~~~~~~~~~~~~~~~
glo.cpp:15:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &t[i]), dp[i] = INF;
   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#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...