제출 #1092046

#제출 시각아이디문제언어결과실행 시간메모리
1092046juicyMoney (IZhO17_money)C++17
100 / 100
675 ms53852 KiB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);

  const int inf = 1e9;
  
  int n; cin >> n;
  set<int> st{inf};
  int l = inf, r = 0, res = 0;
  while (n--) {
    int x; cin >> x;
    if (r < x || x < l) {
      ++res;
      r = *st.upper_bound(x);
    }
    st.insert(l = x);
  }
  cout << res;
  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...