Submission #916790

#TimeUsernameProblemLanguageResultExecution timeMemory
916790sandrofeiqrishviliMoney (IZhO17_money)C++14
100 / 100
1146 ms58140 KiB
#include <bits/stdc++.h> using namespace std; int n, m; set <int> sor; int check(int l, int r) { if(sor.upper_bound(l) == sor.end() || *sor.upper_bound(l)>=r){ return 0; } else{ return 1; } } int main(){ cin >> n; int a[n+10]; for(int i=0; i<n; i++){ cin >> a[i]; } int ans=0; for(int i=0; i<n; i++){//segmentis dasawyisi int st = i; ans++; while (i != n - 1 && a[i] <= a[i + 1] && check(a[st], a[i + 1]) == 0) i++; for(int j=st; j<=i; j++){ sor.insert(a[j]); } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...