제출 #800433

#제출 시각아이디문제언어결과실행 시간메모리
800433hugo_pmEditor (BOI15_edi)C++17
35 / 100
3046 ms7788 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int> level(N+1, 0), value(N+1, -1); vector<bool> active(N+1, false); vector<int> parent(N+1, -1); // edit 0 au début level[0] = 0, value[0] = 0, active[0] = true; for (int iOp = 1; iOp <= N; ++iOp) { int action; cin >> action; if (action < 0) { level[iOp] = -action; parent[iOp] = iOp-1; while (level[parent[iOp]] >= level[iOp]) { parent[iOp] = parent[parent[iOp]]-1; } } else { level[iOp] = 0, value[iOp] = action; } } vector<int> lastEdit(N+1, 0); for (int iOp = 1; iOp <= N; ++iOp) { lastEdit[iOp] = (level[iOp] == 0 ? value[iOp] : lastEdit[parent[iOp]-1]); cout << lastEdit[iOp] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...