Submission #501906

# Submission time Handle Problem Language Result Execution time Memory
501906 2022-01-04T19:00:49 Z SirCovidThe19th Money (IZhO17_money) C++17
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>
using namespace std; 

int main(){
    int n; cin >> n; int A[n], ans = 1; multiset<int> S;
    for (int i = 0; i < n; i++) cin >> A[i], S.insert(A[i]);

    S.erase(S.find(A[n - 1]));
    for (int i = n - 1; i; i--){ //should we include i and i - 1?
        S.erase(S.find(A[i - 1]));
        auto it = S.upper_bound(A[i - 1]);
        if (A[i - 1] > A[i] or (it != S.end() and *it <= A[i])){
            ans++;
        }
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 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 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 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 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 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 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -