This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
int main() {
ll n, d, ans=0; cin >> n >> d;
ll a[n]; for(auto& u : a) cin >> u;
stack<ll> st;
for(ll i=0; i<n; i++){
ll x=a[n-i-1];
while(!st.empty()){
if(st.top()>x) break;
st.pop();
}
st.push(x);
ans=max(ans, (ll)st.size());
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |