제출 #1153765

#제출 시각아이디문제언어결과실행 시간메모리
1153765siewjhPo (COCI21_po)C++20
70 / 70
6 ms580 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int nums; cin >> nums;
	stack<int> st;
	st.push(0);
	int ans = 0;
	for (int i = 0; i < nums; i++){
		int x; cin >> x;
		while (x < st.top()) st.pop();
		if (x > st.top()){
			ans++; st.push(x);
		}
	}
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...