제출 #1294052

#제출 시각아이디문제언어결과실행 시간메모리
1294052LIAMoney (IZhO17_money)C++17
100 / 100
764 ms55176 KiB
// // Created by liasa on 22/11/2025. // #include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; vector<ll> a(n + 1); for (int i = 0; i < n; ++i) cin >> a[i]; int last = 0, ans = 0; set<int> taken; taken.insert(1e7); for (int i = 1; i <= n; ++i) { if (a[i] < a[i - 1]) { while (last < i) { int bigger = *taken.upper_bound(a[last]); while (*taken.lower_bound(a[last]) <= bigger && last < i) taken.insert(a[last++]); ans++; } } } 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...