Submission #916787

#TimeUsernameProblemLanguageResultExecution timeMemory
916787sandrofeiqrishviliMoney (IZhO17_money)C++14
0 / 100
1 ms348 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[i]); } } 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...