Submission #940437

#TimeUsernameProblemLanguageResultExecution timeMemory
940437RifalFinancial Report (JOI21_financial)C++14
12 / 100
31 ms5456 KiB
#include <bits/stdc++.h> #include <fstream> #define endl '\n' #define mod 1000000007 #define INF 2000000000 #define INF2 1000000000000000000 ///#define cin fin ///#define cout fout using namespace std; double const EPS = 1e-14; typedef long long ll; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, d; cin >> n >> d; int arr[n]; for(int i = 0; i < n; i++) cin >> arr[i]; stack<int> st; int ans = 0; for(int i = n-1; i >= 0; i--) { while(!st.empty() && st.top() <= arr[i]) { st.pop(); } st.push(arr[i]); int siz = st.size(); ans = max(siz,ans); } cout << ans << 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...