Submission #1153779

#TimeUsernameProblemLanguageResultExecution timeMemory
1153779yhkhooPo (COCI21_po)C++20
70 / 70
6 ms836 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define fi first #define se second int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n; cin >> n; int a[n]; for(int i=0; i<n; i++){ cin >> a[i]; } stack<int> en; en.push(0); int ans=0; for(int i=0; i<n; i++){ while(a[i] < en.top()){ en.pop(); } if(a[i] > en.top()){ en.push(a[i]); ans++; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...