Submission #89745

#TimeUsernameProblemLanguageResultExecution timeMemory
89745RAkhshonMoney (IZhO17_money)C++14
45 / 100
1567 ms55408 KiB
#include <bits/stdc++.h>
#define ll long long
#define INF  998244353
using namespace std;
ll a[1011011];
set< ll > st;
int main()
{
ll n;
scanf("%lld", &n);
for(ll i = 1; i<= n; i ++ ){
    scanf("%lld", &a[i]);
}
ll ans = 0, i;
st.insert(1000000000);
for(  i = 1; i <= n; i ++ ){
    ans++;
    st.insert(a[i]);
    auto x = st.upper_bound(a[i]);
    while( i < n && a[i]<=a[i+1] && a[i+1]<=*x ){
        st.insert(a[i+1]);
        i++;
    }
}
printf("%lld", ans);
return 0;
}

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:10:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%lld", &n);
 ~~~~~^~~~~~~~~~~~
money.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &a[i]);
     ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...