제출 #741230

#제출 시각아이디문제언어결과실행 시간메모리
741230blackslexGlobal Warming (CEOI18_glo)C++17
0 / 100
46 ms4560 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, k, a[N], b[N], c[N], ans; vector<int> v, u; int main() { scanf("%d %d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) { auto lower = lower_bound(v.begin(), v.end(), a[i] - k); if (lower == v.end()) b[i] = v.size(), v.emplace_back(a[i] - k); else *lower = a[i] - k, b[i] = lower - v.begin(); } for (int i = n; i >= 1; i--) { auto lower = lower_bound(u.begin(), u.end(), a[i]); if (lower == u.end()) c[i] = u.size(), u.emplace_back(a[i]); else *lower = a[i], c[i] = lower - u.begin(); } for (int i = 1; i <= n; i++) ans = max(ans, b[i] + c[i] + 1); printf("%d", ans); }

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

glo.cpp: In function 'int main()':
glo.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
glo.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
      |                                  ~~~~~^~~~~~~~~~~~~
#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...