Submission #259889

#TimeUsernameProblemLanguageResultExecution timeMemory
259889Kenzo_1114Global Warming (CEOI18_glo)C++17
28 / 100
2098 ms1860 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 200010; const int INF = 2e9 + 9; int n, x, t[MAXN], dp[MAXN]; int calc() { for(int i = 0; i < n; i++) dp[i] = INF; int mx = 0; for(int i = 0; i < n; i++) { int it = lower_bound(dp, dp + n, t[i]) - dp; dp[it] = t[i]; mx = max(mx, it); } return mx + 1; } int main () { scanf("%d %d", &n, &x); for(int i = 0; i < n; i++) scanf("%d", &t[i]); int ans = 0; for(int i = 0; i < n; i++) { t[i] -= x; ans = max(ans, calc()); } printf("%d\n", ans); }

Compilation message (stderr)

glo.cpp: In function 'int main()':
glo.cpp:25: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:27:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < n; i++) scanf("%d", &t[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...