Submission #533142

#TimeUsernameProblemLanguageResultExecution timeMemory
5331424fectaFinancial Report (JOI21_financial)C++17
12 / 100
43 ms7940 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)

const int MN = 300005;

int n, d, a[MN], ans;

int32_t main() {
    boost();

    cin >> n >> d;
    for (int i = 1; i <= n; i++) cin >> a[i];
    stack<int> s;
    for (int i = n; i > 0; i--) {
        while (s.size() && a[i] >= s.top()) s.pop();
        s.push(a[i]);
        ans = max(ans, (int) s.size());
    }
    printf("%lld\n", ans);

    return 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...