제출 #883099

#제출 시각아이디문제언어결과실행 시간메모리
883099HusaynMoney (IZhO17_money)C++14
100 / 100
863 ms58204 KiB
#include <bits/stdc++.h> using namespace std; int const N = 1e6 + 9; int a[N]; set <int> t; int main() { cin.tie()->sync_with_stdio(0); int n; cin >> n; for(int i = 0; i < n; i ++) cin >> a[i]; t.insert(-1e9); t.insert(1e9); int ans = 0; for(int i = 0; i < n;) { ans ++; int pos = *t.upper_bound(a[i]); t.insert(a[i]); int j = i + 1; for(;j < n && a[j] >= a[j - 1] && a[j] <= pos; j ++) t.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...