Submission #338011

#TimeUsernameProblemLanguageResultExecution timeMemory
338011boykutMoney (IZhO17_money)C++14
100 / 100
1383 ms58128 KiB
#include <bits/stdc++.h> using namespace std; #define all(a) a.begin(),a.end() signed main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } set <int> st; st.insert(2e9); int ans = 0; for (int i = 0; i < n; i++) { int val = *st.upper_bound(a[i]); st.insert(a[i]); while(a[i + 1] >= a[i] && a[i + 1] <= val && i + 1 < n){ i++; st.insert(a[i]); } ans++; } cout << ans << '\n'; 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...