답안 #1015735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -