Submission #367101

#TimeUsernameProblemLanguageResultExecution timeMemory
367101ritul_kr_singhPo (COCI21_po)C++17
10 / 70
12 ms1516 KiB
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define sp << " " << #define nl << "\n" signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int a[n], ans = 1; for(int& i : a) cin >> i; stack<int> s; s.push(a[0]); for(int i=1; i<n; ++i){ ans += !s.empty() and s.top() < a[i]; while(!s.empty() and s.top() >= a[i]) s.pop(); s.push(a[i]); } cout << ans nl; }
#Verdict Execution timeMemoryGrader output
Fetching results...