| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1158783 | fv3 | Editor (BOI15_edi) | C++20 | 3092 ms | 7120 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef LOCAL
#include "/home/fv3/prog/debug/debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
vector<int> state(N+1), par(N+1), value(N+1), level(N+1);
state[0] = 1;
for (int i = 1; i <= N; i++) {
int a;
cin >> a;
state[i] = 1;
if (a > 0) {
value[i] = a;
} else {
level[i] = -a;
for (int j = i-1; j >= 0; j--) {
if (state[j] && level[j] < level[i]) {
state[j] = 0;
par[i] = j;
while (par[j]) {
j = par[j];
state[j] ^= 1;
}
break;
}
}
}
for (int j = i; j >= 0; j--) {
if (!level[j] && state[j]) {
cout << value[j] << "\n";
break;
}
}
}
}
| # | 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... | ||||
