# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1173062 | thecrazycandy | September (APIO24_september) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int solve (int n, int m, vector <int> v, vector <vector <int>> a) {
int cnt = 0;
for (int i = 0; i < n - 1; i++) {
int ind = 0;
int idx = 0, mn = 1e9 + 1;
for (int j = i + 1; j < n - 1; j++) {
if (a[0][i] < a[0][j]) {
ind = max(ind, j);
}
}
cnt++;
if (ind == 0) continue;
for (int j = i + 1; j <= ind; j++) {
if (a[0][i] > a[0][j] && mn > a[0][j]) {
mn = a[0][j];
idx = j;
}
}
if (idx == 0) {
i = ind;
continue;
}
i = idx - 1;
cnt--;
}
return cnt;
}
int main () {
cout << solve(5, 1, {-1, 0, 1, 2, 3}, {{3, 1, 4, 2}});
}