Submission #853422

# Submission time Handle Problem Language Result Execution time Memory
853422 2023-09-24T10:25:04 Z aymanrs Money (IZhO17_money) C++14
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
void solve(){
    int n;
    cin >> n;
    int a[n];
    int ans = 0;
    set<int> s;
    for(int i = 0;i < n;i++) cin >> a[i];
    for(int i = 0;i < n;){
        ans++;
        int j = i;
        for(;j < n && (j == i || a[j] >= a[j-1]) && s.lower_bound(a[i]) == s.lower_bound(a[j]);j++);
        for(;i < j;i++) s.insert(a[i]);
    }
    cout << ans << '\n';

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -