Submission #533587

# Submission time Handle Problem Language Result Execution time Memory
533587 2022-03-06T12:06:06 Z devariaota Money (IZhO17_money) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
int n;
set<int> sim;
int ans = 1;
int arr[1000005];
int main(){
    cin >> n;
    for(int i=1;i<n;i++){
        cin >> arr[i];
    }
    int batas = 1000000000;
    for(int i=0;i<n;i++){
        if(i != 0 && (arr[i] < arr[i-1] || arr[i] > batas)){
            ans++;
            set<int>::iterator it = sim.upper_bound(arr[i]);
            if(it == sim.end()){
                batas = 1000000000;
            }else{
                batas = *it;
            }
        }
        sim.insert(arr[i]);
    }
    cout << ans << endl;
}
# 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 -