Submission #581599

#TimeUsernameProblemLanguageResultExecution timeMemory
581599colossal_pepeFinancial Report (JOI21_financial)C++17
12 / 100
46 ms4760 KiB
#include <iostream> #include <stack> using namespace std; const int N = 300005; int n, d, a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> d; for (int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; stack<int> s; for (int i = n - 1; i >= 0; i--) { while (not s.empty() and s.top() <= a[i]) s.pop(); s.push(a[i]); ans = max(ans, (int)s.size()); } cout << ans << '\n'; 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...