제출 #883287

#제출 시각아이디문제언어결과실행 시간메모리
883287marcidMoney (IZhO17_money)C++17
100 / 100
1002 ms62136 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+9; #define int long long set<int> k; int ans; signed main() { int n; cin >> n; int a[n]; for (int &i:a) cin >> i; k.insert(1e9); k.insert(-1e9); for (int i = 0; i < n;) { ans++; int it = *k.upper_bound(a[i]); k.insert(a[i]); int j = i + 1; for (; a[j-1]<=a[j] && a[j] <= it && j < n; j++) { k.insert(a[j]); } i = 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...