Submission #530727

#TimeUsernameProblemLanguageResultExecution timeMemory
530727MounirFinancial Report (JOI21_financial)C++14
12 / 100
149 ms7844 KiB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define x first
#define y second
#define int long long
using namespace std;

signed main(){
      int nVals, d; cin >> nVals >> d; //d = 1.
      vector<int> vals(nVals);
      for (int& val : vals)
            cin >> val;
      stack<int> maxis;
      maxis.push(vals[nVals - 1]);
      int opt = 1;
      for (int add = nVals - 2; add >= 0; --add){
            while (!maxis.empty() && maxis.top() <= vals[add])
                  maxis.pop();
            maxis.push(vals[add]);
            chmax(opt, sz(maxis));
      }
      cout << opt << endl;
      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...