제출 #1164567

#제출 시각아이디문제언어결과실행 시간메모리
1164567PwoMoney (IZhO17_money)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, a[1000005];
set<int> st;

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	st.insert(n + 1);
	
	int ans = 1; int j = 1, cur = *st.upper_bound(a[j]);
	while (j <= n) {
		int v = *st.upper_bound(a[j]);
		if (a[j] < a[j - 1] || v != cur) {
			cur = v;
			ans++;
		}
		st.insert(a[j]);
		j++;
	}
	
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...