Submission #1015735

# Submission time Handle Problem Language Result Execution time Memory
1015735 2024-07-06T17:36:20 Z phoenix Money (IZhO17_money) C++17
0 / 100
0 ms 508 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1'000'100;

int n;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;

    set<int> proceeded;
    vector<int> buffer; 
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (buffer.empty() || buffer.back() > a || proceeded.lower_bound(buffer.back()) != proceeded.lower_bound(a)) {
            for (int c : buffer) {
                proceeded.insert(c);
            }
            buffer.clear();
            ans++;
        }
        buffer.push_back(a);
    }
    
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 508 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 508 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 508 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 508 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -