Submission #541088

# Submission time Handle Problem Language Result Execution time Memory
541088 2022-03-22T08:07:24 Z ElnuR_007 Money (IZhO17_money) C++14
Compilation error
0 ms 0 KB
#include<iostream>//Author of this super code <<Zhanbyrbai Elnur>>
#include<bits/stdc++.h>//Program language <<C++>>
#include<cmath>
#include<set>
#include<algorithm>
#include<string>//DIMASH DON'T COPY MY CODE!!!
#include<vector>//YEAH ! I AM ABOUT YOU!
#include<deque>
#include<queue>
#include<map>
#include<stack>
#include <stdio.h>
#define ll long long int
#define strong string
using namespace std;
ll t,n,m,k,cnt,ans;
set<ll>st;
ll a[21]
void auto_solve()
{
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    st.insert(100000000);
    cnt=100000000,ans=1;
    st.insert(a[1]);
    for(ll i=2;i<=n;i++)
    {
        if(a[i]==a[i-1])
        {
            continue;
        }
        auto it=st.lower_bound(a[i]);
        
        if(a[i]<a[i-1] || cnt!=*it)
        {
            ans++;
            cnt=*st.upper_bound(a[i]);
        }
        st.insert(a[i]);
    }
    cout<<ans;
}
int main(/* ElnuR_007 */)
{
	//	freopen("INPUT.txt","r",stdin);
	//  freopen("OUTPUT.txt","w",stdout);
	
    ios_base::sync_with_stdio();
    cin.tie(NULL);
    cout.tie(NULL);
    
    auto_solve();
}

Compilation message

money.cpp:19:1: error: expected initializer before 'void'
   19 | void auto_solve()
      | ^~~~
money.cpp: In function 'int main()':
money.cpp:56:5: error: 'auto_solve' was not declared in this scope
   56 |     auto_solve();
      |     ^~~~~~~~~~