Submission #765560

# Submission time Handle Problem Language Result Execution time Memory
765560 2023-06-24T19:33:22 Z Ahmed57 Money (IZhO17_money) C++17
0 / 100
1 ms 296 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin>>n;
    long long arr[n+1];
    for(int i = 0;i<n;i++){
        cin>>arr[i];
    }
    arr[n] = 0;
    set<int> s;
    int ans = 0;
    auto it = s.end();
    for(int i = 1;i<=n;i++){
        s.insert(arr[i-1]);
        if(arr[i]<arr[i-1]||(it!=s.end()&&(*it)<arr[i])){
            ans++;
            it = s.lower_bound(arr[i]);
        }
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -