이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int min_subsegments_to_sort(int N, vector<int>& banknotes) {
    vector<int> increasing_subsequences(N, 1);
    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < i; ++j) {
            if (banknotes[i] >= banknotes[j]) {
                increasing_subsequences[i] = max(increasing_subsequences[i], increasing_subsequences[j] + 1);
            }
        }
    }
    return N - *max_element(increasing_subsequences.begin(), increasing_subsequences.end());
}
int main() {
    // Input
    int N;
    cin >> N;
    vector<int> banknotes(N);
    for (int i = 0; i < N; ++i) {
        cin >> banknotes[i];
    }
    // Output
    int result = min_subsegments_to_sort(N, banknotes);
    cout << result << endl;
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |