Submission #587865

#TimeUsernameProblemLanguageResultExecution timeMemory
587865MasterTasterMoney (IZhO17_money)C++14
0 / 100
1 ms212 KiB
#include <iostream> #include<set> #define MAXN 1000010 using namespace std; int n, a[MAXN], ress; int main() { cin>>n; for (int i=0; i<n; i++) cin>>a[i]; set<int> s; int i=0; while (i<n) { auto it=s.upper_bound(a[i]); bool nema=0; int br; if (it==s.end()) nema=1; else br=*it; i++; while (i<n && (i==0 || a[i]>=a[i-1]) && (nema || a[i]<=br)) { s.insert(a[i]); i++; } //cout<<i<<endl; ress++; } cout<<ress; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...