답안 #372995

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
372995 2021-03-03T00:02:31 Z sam571128 Po (COCI21_po) C++14
20 / 70
15 ms 1516 KB
#include <bits/stdc++.h>

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int n;
	cin >> n;
	int arr[n];
	stack<int> s;
	int ans = 0;
	for(auto &x : arr){
		cin >> x;
		while(!s.empty()&&s.top()>x){
			s.pop();
		}
		if(s.empty()||s.top()!=x){
			ans++;
			s.push(x);
		}
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 4 ms 748 KB Output isn't correct
5 Incorrect 6 ms 876 KB Output isn't correct
6 Correct 15 ms 1516 KB Output is correct
7 Incorrect 12 ms 1132 KB Output isn't correct