Submission #990041

#TimeUsernameProblemLanguageResultExecution timeMemory
990041tch1cherinMoney (IZhO17_money)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N; cin >> N; vector<int> a(N); for (int &value : a) { cin >> value; } set<int> S; int answer = 1; for (int i = 1; i < N; i++) { if (a[i] < a[i - 1]) { answer++; } else { auto it = S.upper_bound(a[i - 1]); answer += it != S.end() && *it <= a[i]; } S.insert(a[i - 1]); } cout << answer << "\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...