# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
216562 |
2020-03-27T13:54:43 Z |
hugo_pm |
Editor (BOI15_edi) |
C++17 |
|
58 ms |
5364 KB |
#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 time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
3576 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
3444 KB |
Output is correct |
2 |
Correct |
34 ms |
3704 KB |
Output is correct |
3 |
Correct |
45 ms |
3320 KB |
Output is correct |
4 |
Correct |
48 ms |
3704 KB |
Output is correct |
5 |
Correct |
58 ms |
5364 KB |
Output is correct |
6 |
Correct |
39 ms |
2808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |