Submission #501900

# Submission time Handle Problem Language Result Execution time Memory
501900 2022-01-04T18:36:07 Z SirCovidThe19th Money (IZhO17_money) C++17
0 / 100
0 ms 292 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.find(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 0 ms 204 KB Output is correct
3 Correct 0 ms 292 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 292 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 292 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 292 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -