Submission #1052061

#TimeUsernameProblemLanguageResultExecution timeMemory
1052061SacharlemagneFinancial Report (JOI21_financial)C++17
0 / 100
77 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; --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...