제출 #990039

#제출 시각아이디문제언어결과실행 시간메모리
990039tch1cherinMoney (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; int answer = 1; for (int i = 1; i < N; i++) { if (a[i] < a[i - 1]) { answer++; } else { auto it = S.lower_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...