Submission #640376

#TimeUsernameProblemLanguageResultExecution timeMemory
640376tvladm2009Money (IZhO17_money)C++14
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using ll = long long; const int MAX_N = 1e6; int a[1 + MAX_N]; std::set<int> s; int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); int n; std::cin >> n; for (int i = 1; i <= n; i++) { std::cin >> a[i]; } int answer = 0, next = 0; s.insert((1 << 30)); for (int i = 1; i <= n; i++) { if (i == 1 || a[i - 1] >= a[i] || (*s.lower_bound(a[i])) != next) { answer++; next = *s.lower_bound(a[i]); } s.insert(a[i]); } std::cout << answer; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...