Submission #1092046

#TimeUsernameProblemLanguageResultExecution timeMemory
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...