Submission #533494

# Submission time Handle Problem Language Result Execution time Memory
533494 2022-03-06T07:59:22 Z kebine Money (IZhO17_money) C++17
0 / 100
1 ms 324 KB
#include<bits/stdc++.h>
using namespace std;

int n;
set<int> sim;
int ans = 0;
int arr[1000005];

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }

    ans++;
    int batas = 1000000000;
    for(int i = 1; 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 << "\n";

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 324 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 324 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 324 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 324 KB Output isn't correct
4 Halted 0 ms 0 KB -