Submission #513765

# Submission time Handle Problem Language Result Execution time Memory
513765 2022-01-17T15:10:23 Z blue Money (IZhO17_money) C++17
0 / 100
1 ms 312 KB
#include <iostream>
#include <set>
using namespace std;

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

    int N;
    cin >> N;

    int a[1+N];
    for(int i = 1; i <= N; i++) cin >> a[i];
    a[0] = 1'000'001;

    set<int> A;

    int res = 0;

    A.insert(1'000'001);

    int lim = 1'000'001;


    for(int i = 1; i <= N; i++)
    {
        if(a[i] < a[i-1] || a[i] > lim)
        {
            res++;
            lim = *A.lower_bound(a[i]);
            A.insert(a[i]);
        }
        else
        {
            // if(a[i] > lim)
            A.insert(a[i]);
        }
    }

    cout << res << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -