답안 #541090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541090 2022-03-22T08:08:41 Z ElnuR_007 Money (IZhO17_money) C++14
컴파일 오류
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("money.in","r",stdin);
	freopen("money.out","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:50:33: error: expected ';' before 'ios_base'
   50 |  freopen("money.out","w",stdout)
      |                                 ^
      |                                 ;
   51 | 
   52 |     ios_base::sync_with_stdio();
      |     ~~~~~~~~                     
money.cpp:56:5: error: 'auto_solve' was not declared in this scope
   56 |     auto_solve();
      |     ^~~~~~~~~~
money.cpp:49:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |  freopen("money.in","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
money.cpp:50:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |  freopen("money.out","w",stdout)
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~