# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31757 | aome | K개의 묶음 (IZhO14_blocks) | C++14 | 373 ms | 4172 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> p;
const int N = 100005;
const int INF = 1e9;
int n, k, f[2][N], a[N];
int main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
ios::sync_with_stdio(false);
cin >> n >> k;
for (int i = 1; i <= n; ++i) cin >> a[i];
for (int i = 1; i <= n; ++i) f[0][i] = INF;
for (int i = 1; i <= k; ++i) {
bool t = i & 1;
stack<p> st[2];
f[t][0] = INF;
for (int j = 1; j <= n; ++j) {
int pos = j;
int val = f[t ^ 1][j - 1];
while (st[0].size() && a[st[0].top().fi] <= a[j]) {
pos = st[0].top().se.fi;
val = min(val, st[0].top().se.se);
st[0].pop();
# | 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... |