Submission #501901

# Submission time Handle Problem Language Result Execution time Memory
501901 2022-01-04T18:38:03 Z SirCovidThe19th Money (IZhO17_money) C++17
0 / 100
1 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]);

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