Submission #1052064

#TimeUsernameProblemLanguageResultExecution timeMemory
1052064SacharlemagneFinancial Report (JOI21_financial)C++17
12 / 100
75 ms3924 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,d; cin >> n >> d; vector<int> v(n); for (int &i : v) cin >> i; vector<int> activate(n); stack<int> q; for (int i = 0; i<n; ++i) { while (!q.empty() && v[q.top()] < v[i]) q.pop(); if (!q.empty()) ++activate[q.top()]; q.push(i); } int cur = 0, ans = 1; for (int i = n-1; i+1; --i) { cur -= activate[i]-1; ans = max(ans, cur); } cout << ans; }
#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...