Submission #550756

#TimeUsernameProblemLanguageResultExecution timeMemory
550756tht2005Financial Report (JOI21_financial)C++17
0 / 100
4045 ms5452 KiB
#include <bits/stdc++.h> using namespace std; const int N = 300005; int n, d, a[N], f[N]; int main() { scanf("%d %d", &n, &d); for(int i = 0; i < n; ++i) { scanf("%d", a + i); } for(int i = 0; i < n; ++i) { f[i] = 1; for(int j = i - 1; j >= 0 && i - j <= d; --j) { if(a[j] < a[i]) { f[i] = max(f[i], f[j] + 1); } } } printf("%d", *max_element(f, f + n)); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &d);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         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...