제출 #216562

#제출 시각아이디문제언어결과실행 시간메모리
216562hugo_pmEditor (BOI15_edi)C++17
28 / 100
58 ms5364 KiB
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int borne = 301*1000; int nbOp; // + : undo / - : edit int tab[borne]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> nbOp; for (int i = 0; i < nbOp; ++i) { cin >> tab[i]; tab[i] = -tab[i]; if (i > 0) cout << "0\n"; } vector<pii> pile; for (int iOp = nbOp-1; iOp >= 0; --iOp) { int lvl = max(0, tab[iOp]); if (pile.empty() || lvl >= pile.back().first) { pile.push_back({lvl, -tab[iOp]}); } else { pile.pop_back(); } } if (pile.empty() || pile.front().first > 0) { cout << "0\n"; } else { cout << pile.front().second << "\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...