Submission #535177

# Submission time Handle Problem Language Result Execution time Memory
535177 2022-03-09T15:06:37 Z devariaota Money (IZhO17_money) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
#define REP(v, i, j) for (int v = i; v != j; v++)
#define FORI(v) for (auto i : v)
#define FORJ(v) for (auto j : v)

#define OUT(v, a)     FORI(v)           cout << i << a;
#define OUTS(v, a, b)          cout << v.size() << a;     OUT(v, b)
#define in(a, n)     REP(i, 0, n)     cin >> a[i];

#define SORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))

#define pb push_back
#define fi first
#define se second

#define detachIO                          ios_base::sync_with_stdio(false);     cin.tie(0);                           cout.tie(0);

using namespace std;

typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<pii, pii> piiii;

set<int> st;
vector<int> v;

int main()
{
    detachIO;

    int N;
    cin >> N;

    while (N--)
    {
        int x;
        cin >> x;
        if (st.upper_bound(x) != st.end())
            v.pb(*st.upper_bound(x));
        else
            v.pb(1E8);
        st.insert(x);
        // cout << v.back() << ' ';
    }

    int c = 1E9;
    int ans = 0;

    FORI(v)
    {
        if (c > i)
            ans++;
        c = i;
    }

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