Submission #990038

#TimeUsernameProblemLanguageResultExecution timeMemory
990038tch1cherinMoney (IZhO17_money)C++17
0 / 100
1 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 = {a[0]}; int answer = 1; for (int i = 1; i < N; i++) { S.insert(a[i]); if (a[i] < a[i - 1]) { answer++; } else { auto it = S.upper_bound(a[i - 1]); answer += it != S.end() && *it < a[i]; } } 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...