Submission #464248

#TimeUsernameProblemLanguageResultExecution timeMemory
464248Hamed5001Money (IZhO17_money)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mxN = 1e6+10; int N, A[mxN], ans; void solve() { cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; multiset<int> mst; for (int i = 0; i < N; i++) { int j = i+1; auto it = mst.lower_bound(A[i]); while(j < N && (A[j] >= A[j-1]) && (it == mst.end() || *it >= A[j])) j++; for (int ii = i; ii < j; ii++) mst.insert(A[ii]); i = j-1; ans++; } cout << ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...