제출 #501927

#제출 시각아이디문제언어결과실행 시간메모리
501927SirCovidThe19thMoney (IZhO17_money)C++17
45 / 100
1547 ms53424 KiB
#include <bits/stdc++.h> using namespace std; int n, ans = 1, A[1000005]; multiset<int> S; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> A[i], S.insert(A[i]); S.erase(S.find(A[n - 1])); for (int l = n - 2, r = n - 1; ~l; l--){ //create new group at l? S.erase(S.find(A[l])); auto it = S.upper_bound(A[l]); if (A[l] > A[l + 1] or (it != S.end() and *it < A[r])) ans++, r = l; } cout<<ans<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...