Submission #341443

#TimeUsernameProblemLanguageResultExecution timeMemory
341443katearimaMoney (IZhO17_money)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e6+5; int n,t,ans, a[N], mn,mx; set <int> st; set<int>::iterator itr; main(){ cin>>n; mn=1e6+4; for(int i=0; i<n; i++){ cin>>a[i]; mx=max(mx, a[i]); mn=min(mn, a[i]); } mn--; mx++; st.insert(mn); st.insert(mx); for(int i=0; i<n; i++){ st.insert(a[i]); while(a[i]<=a[i+1] && a[i+1]<= *st.upper_bound(a[i])){ st.insert(a[i+1]); i++; } ans++; } cout<<ans<<endl; }

Compilation message (stderr)

money.cpp:7:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...