# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
660152 | 2022-11-20T14:49:15 Z | kinope | Editor (BOI15_edi) | C++14 | 116 ms | 11900 KB |
#include <bits/stdc++.h> using namespace std; struct p{ int v; bool on; }; int main(){ int n; scanf("%d", &n); vector<p> act(n); vector<int> ojc(n, -1); set<pair<int, int>> s; for(int i = 0; i < n; ++i){ int a; scanf("%d", &a); if(a > 0){ act[i] = {a, 1}; s.emplace(i, a); printf("%d\n", (*prev(s.end())).second); continue; } act[i] = {a, 1}; for(int j = i-1; ~j; --j) if(act[j].v > a){ ojc[i] = j; for(int x = j; ~x; x = ojc[x]){ act[x].on^=1; if(ojc[x] < 0){ pair<int, int> tmp = {x, act[x].v}; if(act[x].on) s.emplace(x, act[x].v); else s.erase(tmp); } } break; } if(s.empty()) printf("0\n"); else printf("%d\n", (*prev(s.end())).second); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 116 ms | 11900 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 7420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |