답안 #943291

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
943291 2024-03-11T10:11:30 Z maxFedorchuk Money (IZhO17_money) C++17
0 / 100
1 ms 468 KB
#include <bits/stdc++.h>
using namespace std;

const int MX=1e6+10;
int a[MX];

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    int n;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    set < int > st;
    st.insert(MX);
    int bgz=MX;

    int ans=1;
    for(int i=2;i<=n;i++)
    {
        st.insert(a[i]);

        if(a[i-1]>a[i] || a[i]>bgz)
        {
            ans++;
            bgz=(*st.upper_bound(a[i]));
        }
    }

    cout<<ans<<"\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 468 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -