제출 #546412

#제출 시각아이디문제언어결과실행 시간메모리
546412syrtinMoney (IZhO17_money)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h>
#define ss second
#define ff first
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1e5 + 123;
const int mod = 998244353;
const int inf = 1e9;
void solve() {
	int n;
	cin >> n;
	int a, ans = 1, x = -1;
	set<int> s;
	while(n) {
		cin >> a;
		if(a > x) {
			x = a;
			s.insert(x);
		}
		else {
			ans++;
			x = a;
			s.insert(x);
			n--;
			break;
		}
		n--;
	}
	while(n) {
		cin >> a;
		if(s.upper_bound(x) != s.upper_bound(a))ans++;
		s.insert(a);
		x = a;
		n--;
	}
	cout << ans;
}
int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--) {
		solve();
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...